Thank you Daniel, I have a few more questions: QUESTION 1: ----------- Using the __asm jsr technique, how would execution of functions with parameters be setup? e.g. test_n(uchar a, my_struct b) QUESTION 2: ----------- Based on your inputs and some quick tests, I just discovered that BANKED code access can be done in the FLAT model by using the __far modifier on modules that are linked to paged flash locations. This is a revelation to me. I was under the impression that only BANKED model could properly control compiler behavior, linkage, and memory flash programming, etc. This is very helpful in resolving my problem. In the interest of maintaining my code library compatibility with other projects is there a way to "at compile time" have a module declared __near or __far based on the dynamics of the particular project? QUESTION 3: ----------- Can the compiler resolve calls to modules in the same bank and execute a JSR automatically even if the called module is flagged as __far? e.g. (912HCDG128A) #pragma CODE_SEG PAGE1 /* Set to 18000 BANK */ static void __near test_n(void) { } static void __far test_f(void) { } void test1(void) { test_n(); // ASM generates JSR here due to __near test_f(); // ASM generates CALL here due to __far even though in same BANK } #pragma CODE_SEG DEFAULT /* Set to non-BANKED 0E000 */ void main(void) { test_n(); // ASM generates JSR here also!! Problem, the module is outside the page bounds! test_f(); // ASM generates CALL here, OK! } PRM File: SECTIONS RAM_PAGE = READ_WRITE 0x02010 TO 0x03FFF; MONITOR_BLOCK = READ_ONLY 0x0E000 TO 0x0FFFF; /* banked FLASH ROM */ FLASH_PPAGE0 = READ_ONLY 0x08000 TO 0x0BFFF; FLASH_PPAGE1 = READ_ONLY 0x18000 TO 0x19FFF; END PLACEMENT _PRESTART, STARTUP, ROM_VAR, STRINGS, NON_BANKED, DEFAULT_ROM, COPY INTO MONITOR_BLOCK; PAGE0 INTO FLASH_PPAGE0; PAGE1 INTO FLASH_PPAGE1; DEFAULT_RAM INTO RAM_PAGE; END STACKSIZE 0x100 -----Original Message----- From: Daniel Friederich [mailto:] Sent: Thursday, January 08, 2004 1:29 PM To: Subject: RE: [68HC12] Banked Program - JSR and CALL in the same code a little example with the Metrowerks compiler: For example #pragma CODE_SECTION PAGE10 static void __near test_n(void) { } static void __far test_f(void) { } void test1(void) { __asm jsr test_f; __asm call test_n; } Then place this PAGE10 section in your PRM file into one page only. Bye Daniel > -----Original Message----- > From: Gordon Doughman [mailto:] > Sent: Thursday, January 08, 2004 16:03 > To: > Subject: Re: [68HC12] Banked Program - JSR and CALL in the same code > Steve, > > With the Cosmic compiler, any functions not modified by the @far > qualifier are compiled using JSR/RTS. For this to work, you must make > sure that there are no references to the 'near' functions outside the > compile module in which they are defined. > > Regards, > Gordon > > Killingsworth, Steve wrote: > > >I have code that was configured to run in FLAT mode (SMALL memory model) on > >a DG128A using Metrowerks CodeWarrior. > > > >I am trying to convert it to run in BANKED mode and have run into a problem. > > > >I have some legacy in-line asm code that is not tolerant to the CALL/RTC > >construct and associated register manipulations. > > > >Is it possible to force routines in the same PPAGE to use JSR/RTS and still > >allow CALL/RTC for non-same PPAGE module calls. > > > > > >Thanks > > > > > >This e-mail and any files transmitted with it ( Message ) are confidential and may contain privileged information. > >This Message is intended solely for the addressee(s). If you have received this Message in error, please inform us > promptly by reply e-mail then delete the Message and destroy any printed copy of it. > >Any unauthorized use, review, retransmission, dissemination, distribution, printing or copying of this Message or any > part thereof is strictly prohibited. > >E-mails are susceptible to alteration. Neither Perry Slingsby Systems nor any of its subsidiaries and affiliates shall > be liable for the Message if altered, changed or falsified > > > >--------------------To learn more about Motorola Microcontrollers, please visit > >http://www.motorola.com/mcu > >o learn more about Motorola Microcontrollers, please visit > >http://www.motorola.com/mcu > > > > > > > > > > > > > > > > -- > =============================================================== > Gordon Doughman Ph: 937-438-6811 > Motorola Semiconductor Fax: 937-434-7457 > Field Applications Engineer Pager: 800-759-8352 Pin: 1304089 > Suite 175 > 3131 Newmark Drive > Miamisburg, OH 45342 > > Check out my HC12 book at: > http://www.rtcbooks.com/programming.php > > > --------------------To learn more about Motorola Microcontrollers, please visit > http://www.motorola.com/mcu > o learn more about Motorola Microcontrollers, please visit > http://www.motorola.com/mcu --------------------To learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu o learn more about Motorola Microcontrollers, please visit http://www.motorola.com/mcu This e-mail and any files transmitted with it ( Message ) are confidential and may contain privileged information. This Message is intended solely for the addressee(s). If you have received this Message in error, please inform us promptly by reply e-mail then delete the Message and destroy any printed copy of it. Any unauthorized use, review, retransmission, dissemination, distribution, printing or copying of this Message or any part thereof is strictly prohibited. E-mails are susceptible to alteration. Neither Perry Slingsby Systems nor any of its subsidiaries and affiliates shall be liable for the Message if altered, changed or falsified |