All,
How do I initialize the stack for banked memory for the 9S12DP256 in Start12.c? and, is it the same then for the 9S12DJ64 cpu? Compiler line has: -CpPpage=RUNTIME -Mb -D_HCS12 In Start12.c: Is not the stack being set with this macro? void _Startup(void) { #endif /* purpose: 1) initialize the stack 2) initialize the RAM, copy down init data etc (Init) 3) call main; parameters: NONE called from: _PRESTART-code generated by the Linker or directly referenced by the reset vector */ for(;;) { /* forever: initialize the program; call the root-procedure */ if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) { /* initialize the stack pointer */ INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */ } Thanks in advance. |
|
How do I initialize the stack for banked memory mode?
Started by ●August 25, 2004
Reply by ●August 26, 20042004-08-26
What you show below is that startup code using the startup descriptor generated by the linker. Have a look into the macro INIT_SP_FROM_STARTUP_DESC (defined in hidef.h) You will see something like #define INIT_SP_FROM_STARTUP_DESC() __asm LDS _startupData.stackOffset; The stackOffset is where you have it defined in your linker .prm file (either with STACKSIZE or STACKTOP). This is the same for all derivatives. Erich > -----Original Message----- > From: codewarr2000 [mailto:] > Sent: Mittwoch, 25. August 2004 22:28 > To: > Subject: [68HC12] How do I initialize the stack for banked > memory mode? > All, > How do I initialize the stack for banked memory for the > 9S12DP256 in Start12.c? and, is it the same then for the 9S12DJ64 cpu? > > Compiler line has: > -CpPpage=RUNTIME -Mb -D_HCS12 > In Start12.c: Is not the stack being set with this macro? > > void _Startup(void) { > #endif > /* purpose: 1) initialize the stack > 2) initialize the RAM, copy down init data etc (Init) > 3) call main; > parameters: NONE > called from: _PRESTART-code generated by the Linker > or directly referenced by the reset vector */ > for(;;) { /* forever: initialize the program; call the > root-procedure */ > if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) { > /* initialize the stack pointer */ > INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ > /* HLI macro definition in hidef.h */ > } > > Thanks in advance. > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> > $9.95 domain names from Yahoo!. Register anything. > http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dN_tlB/TM > -------------------------- > ------~- > Yahoo! Groups Links > |
|
Reply by ●August 26, 20042004-08-26
I have it in my PRM file STACKSIZE 0x0080. CPU bean Do Not Generate PRM file. I had origionally defined the stacksize in the cpu bean, generated the PRM file, then turned off autogeneration. Now if I change the PRM file to STACKSIZE 0x0100 I am getting the problem listed in Yahoo message 8114 <timeout> when trying to load (that RAM problem was fixed." I was having a problem with an Interrupt calling code in another bank and not returning correctly - it was going out to another bank and running off. Metrowerks replied that I had not set the stack pointer. I had and have always set it in the PRM file as 0x0080. So I thought that the stack was not large enough, so this is why I am trying to set a larger size. 0x2308 and 0x2387 are the bounds in the map file set for stack. So what exactly is the problem? Is it the stack size? How does one calculate a good stack size? If I need to increase the stack size, do I need to do it from the CPU bean and generate a new PRM, then include my modifications back in, then turn off auto generation? Thanks in advance. Clayton. --- In , "Erich Styger" <estyger@m...> wrote: > What you show below is that startup code using the startup descriptor > generated by the linker. > Have a look into the macro > INIT_SP_FROM_STARTUP_DESC > (defined in hidef.h) > > You will see something like > #define INIT_SP_FROM_STARTUP_DESC() __asm LDS _startupData.stackOffset; > > The stackOffset is where you have it defined in your linker .prm file > (either with STACKSIZE or STACKTOP). > > This is the same for all derivatives. > Erich > > -----Original Message----- > > From: codewarr2000 [mailto:codewarr2000@y...] > > Sent: Mittwoch, 25. August 2004 22:28 > > To: > > Subject: [68HC12] How do I initialize the stack for banked > > memory mode? > > > > > > All, > > > > > > How do I initialize the stack for banked memory for the > > 9S12DP256 in Start12.c? and, is it the same then for the 9S12DJ64 cpu? > > > > Compiler line has: > > -CpPpage=RUNTIME -Mb -D_HCS12 > > > > > > In Start12.c: Is not the stack being set with this macro? > > > > void _Startup(void) { > > #endif > > /* purpose: 1) initialize the stack > > 2) initialize the RAM, copy down init data etc (Init) > > 3) call main; > > parameters: NONE > > called from: _PRESTART-code generated by the Linker > > or directly referenced by the reset vector */ > > for(;;) { /* forever: initialize the program; call the > > root-procedure */ > > if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) { > > /* initialize the stack pointer */ > > INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ > > /* HLI macro definition in hidef.h */ > > } > > > > > > > > Thanks in advance. > > > > > > > > ------------------------ Yahoo! Groups Sponsor > > --------------------~--> > > $9.95 domain names from Yahoo!. Register anything. > > http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dN_tlB/TM > > -------------------------- > > ------~-> > > > > > > Yahoo! Groups Links > > > > > > > > > > > > |
|
Reply by ●August 27, 20042004-08-27
If you call a banked routine from non banked/interrupt function: make
sure that you call it with the right calling convention. Is your banked function correctly called with a CALL instruction? And your called banked routine is returning with a RTC instruction? This may be your problem. Erich > -----Original Message----- > From: codewarr2000 [mailto:] > Sent: Donnerstag, 26. August 2004 18:08 > To: > Subject: [68HC12] Re: How do I initialize the stack for > banked memory mode? > I have it in my PRM file STACKSIZE 0x0080. > CPU bean Do Not Generate PRM file. > > I had origionally defined the stacksize in the cpu bean, > generated the PRM file, then turned off autogeneration. > > Now if I change the PRM file to STACKSIZE 0x0100 I am getting > the problem listed in Yahoo message 8114 <timeout> when > trying to load (that RAM problem was fixed." > > I was having a problem with an Interrupt calling code in > another bank and not returning correctly - it was going out > to another bank and running off. Metrowerks replied that I > had not set the stack pointer. I had and have always set it > in the PRM file as 0x0080. So I thought that the stack was > not large enough, so this is why I am trying to set a larger size. > > 0x2308 and 0x2387 are the bounds in the map file set for stack. > > So what exactly is the problem? Is it the stack size? How > does one calculate a good stack size? > > If I need to increase the stack size, do I need to do it from > the CPU bean and generate a new PRM, then include my > modifications back in, then turn off auto generation? > > Thanks in advance. Clayton. > --- In , "Erich Styger" <estyger@m...> wrote: > > What you show below is that startup code using the startup > descriptor > > generated by the linker. Have a look into the macro > > INIT_SP_FROM_STARTUP_DESC > > (defined in hidef.h) > > > > You will see something like > > #define INIT_SP_FROM_STARTUP_DESC() __asm LDS > _startupData.stackOffset; > > > > The stackOffset is where you have it defined in your linker > .prm file > > (either with STACKSIZE or STACKTOP). > > > > This is the same for all derivatives. > > > > > > Erich > > > > > > > -----Original Message----- > > > From: codewarr2000 [mailto:codewarr2000@y...] > > > Sent: Mittwoch, 25. August 2004 22:28 > > > To: > > > Subject: [68HC12] How do I initialize the stack for banked > > > memory mode? > > > > > > > > > All, > > > > > > > > > How do I initialize the stack for banked memory for the > > > 9S12DP256 in Start12.c? and, is it the same then for the > 9S12DJ64 cpu? > > > > > > Compiler line has: > > > -CpPpage=RUNTIME -Mb -D_HCS12 > > > > > > > > > In Start12.c: Is not the stack being set with this macro? > > > > > > void _Startup(void) { > > > #endif > > > /* purpose: 1) initialize the stack > > > 2) initialize the RAM, copy down init > data etc (Init) > > > 3) call main; > > > parameters: NONE > > > called from: _PRESTART-code generated by the Linker > > > or directly referenced by the reset vector */ > > > for(;;) { /* forever: initialize the program; call the > > > root-procedure */ > > > if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) { > > > /* initialize the stack pointer */ > > > INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ > > > /* HLI macro definition in hidef.h */ > > > } > > > > > > > > > > > > Thanks in advance. > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > > > --------------------~--> > > > $9.95 domain names from Yahoo!. Register anything. > > > http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dN_tlB/TM > > > -------------------------- > > > ------~-> > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > --------------------~--> > Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. > Now with Pop-Up Blocker. Get it for free! > http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/dN_tlB/TM > -------------------------- > ------~- > Yahoo! Groups Links > |