Hi everybody,
I tried it with a smaller program. No it works, I have to figure out, whats
wrong with the other.
Now, I wonder about something else:
When I compile the code example blinky.c with the --xstack option, my
output.mem shows that 256byte of P-Ram is used. As you can see in the attached
blinky.c, I did not use the __reenrant option in the code.
Question: Do I understand the sdcc-manual right, that only the __reentrant
function are placed on P-Ram? Why does the blinky.c use that much P-Ram
although I did not use __reentrant functions?
------------------------------------------
Internal RAM layout:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00:|0|0|0|0|0|0|0|0|a|a|S|S|S|S|S|S|
0x10:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x20:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x30:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x40:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x50:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x60:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x70:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x80:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0x90:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xa0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xb0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xc0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xd0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xe0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0xf0:|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|S|
0-3:Reg Banks, T:Bit regs, a-z:Data, B:Bits, Q:Overlay, I:iData, S:Stack,
A:Absolute
Stack starts at: 0x0a (sp set to 0x09) with 246 bytes available.
Xstack starts at: 0x0000 with 256 bytes available.
Other memory:
Name Start End Size Max
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0x0000 0x00ff 256 256
EXTERNAL RAM 0x0100 0x0101 2 65536
ROM/EPROM/FLASH 0x0000 0x0140 321 65536
----------------------------------------------------------------
----blinky.c-----------
//------------------------------------------------------------------------------------
// F12x_Blinky.c
//------------------------------------------------------------------------------------
// Copyright (C) 2007 Silicon Laboratories, Inc.
//
// AUTH: BD
// DATE: 1 JUL 2002
//
// This program flashes the green LED on the C8051F120 target board about five
times
// a second using the interrupt handler for Timer3.
// Target: C8051F12x
//
//------------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------------
#include <C8051F120.h> // SFR declarations
//-----------------------------------------------------------------------------
// 16-bit SFR Definitions for 'F12x
//-----------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// Global CONSTANTS
//------------------------------------------------------------------------------------
#define SYSCLK 240000000 // approximate SYSCLK frequency in Hz
sbit at 0x96 LED; //SDCC // green LED: '1' = ON; '0' =
OFF
//------------------------------------------------------------------------------------
// Function PROTOTYPES
//------------------------------------------------------------------------------------
void PORT_Init (void);
void Timer3_Init (int counts);
void Timer3_ISR (void) interrupt 14;
//------------------------------------------------------------------------------------
// MAIN Routine
//------------------------------------------------------------------------------------
void main (void)
{
// disable watchdog timer
WDTCN = 0xde;
WDTCN = 0xad;
SFRPAGE = CONFIG_PAGE; // Switch to configuration page
PORT_Init ();
SFRPAGE = TMR3_PAGE; // Switch to Timer 3 page
Timer3_Init (SYSCLK / 12 / 10); // Init Timer3 to generate interrupts
// at a 10 Hz rate.
EA = 1; //
enable global interrupts
SFRPAGE = LEGACY_PAGE; // Page to sit in for now
while (1)
{ // spin forever
}
}
//------------------------------------------------------------------------------------
// PORT_Init
//------------------------------------------------------------------------------------
//
// Configure the Crossbar and GPIO ports
//
void PORT_Init (void)
{
XBR2 = 0x40; // Enable crossbar and weak pull-ups
P1MDOUT |= 0x40; // enable P1.6 (LED) as push-pull output
}
//------------------------------------------------------------------------------------
// Timer3_Init
//------------------------------------------------------------------------------------
//
// Configure Timer3 to auto-reload and generate an interrupt at interval
// specified by <counts> using SYSCLK/12 as its time base.
//
//
void Timer3_Init (int counts)
{
TMR3CN = 0x00; // Stop Timer3; Clear TF3;
// use SYSCLK/12 as timebase
RCAP3 = -counts; // Init reload values
TMR3 = 0xffff; // set to reload immediately
EIE2 |= 0x01; // enable Timer3 interrupts
TR3 = 1; // start Timer3
}
//------------------------------------------------------------------------------------
// Interrupt Service Routines
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
// Timer3_ISR
//------------------------------------------------------------------------------------
// This routine changes the state of the LED whenever Timer3 overflows.
//
// NOTE: The SFRPAGE register will automatically be switched to the Timer 3 Page
// When an interrupt occurs. SFRPAGE will return to its previous setting on
exit
// from this routine.
//
void Timer3_ISR (void) interrupt 14
{
TF3 = 0; // clear TF3 (Interrupt Flag of Timer 3)
if (LED == 1)
{
LED = 0;
}
else
{
LED = 1;
} // change state of LED
}
-------- Original-Nachricht --------
> Datum: Tue, 1 Jun 2010 12:08:01 +0200 (CEST)
> Von: "Maarten Brock" <[email protected]>
> An: [email protected]
> Betreff: Re: [Sdcc-user] recompile libraries
> Hi Oliver,
>
> I don't see much wrong in your approach. The values for --xram-size and
> --code-size are a bit weird though and so is the reported End of Paged Ext
> Ram. Isn't the external ram 8192 bytes and 256 bytes internal (default)?
> And does your code need more than 64k code? If so, are you using banked
> functions or banked constant data?
>
> And finally, what does "did not work" mean exactly? Are you by any chance
> using a SiLabs C8051F12x or other mcu that you can debug in-circuit? Can
> you try to find out what/where it goes wrong?
>
> HTH,
> Maarten
>
> > Hi everybody,
> >
> > I'm working with SDCC to compile code for 8051. My System:
> KUbuntu-10.04.
> > I'm trying to use the --xstack option to compile code. Therefor I had to
> > recompile the mcs51 libraries. Here is the way I did it:
> >
> > In the following folder:
> >
> > /sdcc/device/lib
> >
> > I called the Makefile with the following model:
> >
> > make model-mcs51-xstack-auto
> >
> > In the build folder, I got the following new folders:
> > -large-xstack-auto
> > -medium-xstack-auto
> > -small-xstack-auto
> >
> > Now If I try to compile/build my code, with the following arguments:
> > --model-large -c --use-stdout --xstack (compile)
> > --model-large --xram-size 8448 --code-size 131072 --use-stdout (build
> >
> > I get the following error:
> > ?Aslink-Warning-Undefined Global '__modsint_PARM_2' referenced by module
> > test
> >
> > So the Linker does not find all libraries. Waht I mentioned is, the
> model
> > in the Makefile looks like this:
> >
> > model-mcs51-xstack-auto:
> > if grep '^mcs51\>' $(top_builddir)/ports.build > /dev/null; then
> \
> > for model in $(MODELS); do \
> > mkdir -p $${model}-xstack-auto; cp $${model}/Makefile
> > $${model}-xstack-auto; \
> > $(MAKE) MODELFLAGS="--model-$$model --xstack --stack-auto"
> > PORT=$${model}-xstack-auto
> > PORTDIR=$(BUILDDIR)/$${model}-xstack-auto
> > PORTINCDIR=$(INCDIR)/mcs51 objects; \
> > done \
> > fi
> >
> >
> > The libraries are compiled with the following arguments:
> >
> > MODELFLAGS="--model-$$model --xstack --stack-auto"
> >
> > Because I only wanted to compile the libs with the option --xstack, I
> > changed the MODELFLAGS to:
> >
> > MODELFLAGS="--model-$$model --xstack"
> >
> > Now, when I try to compile my code, I do not get any error, but when I
> > flash the code on my Chip, it does not work.
> > My output.mem looked like this:
> >
> > Name Start End Size Max
> > ---------------- -------- -------- -------- --------
> > PAGED EXT. RAM 0x0000 0x0cff 99 256
> >
> > Thats what I axpected, but unfortunately, my code did not work
> >
> >
> > So my question:
> > How can I compile the libraries to use the --xstack-option. I do not
> want
> > to use the --stack-auto-option. I only want to bring all
> > reentrant-function (functions I marked as __reentrant) to PAGED EXT.
> RAM.
> >
> > Regards
> > Oliver
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Sdcc-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
--
GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user