Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
Hi everybody, I have to put an application and a bootloader in flash. The bootloader is located from 0xE000 to 0xFFFF (non banked page) The application is located form 0xC000 to 0xDFFF for ISR and initialized data (variables and constants). The page from 0x4000 is reserved. But I have not enough place to put ISR code and initialized data from 0xC000 to 0xDFFF. I've tried to put constants into banked page but it's not working, it doesn't crash but the application dosn't work very well. I think that values of constants are not good. Have you got an idea to put this constants into baked page ??? Many thanks in advance.
> I've tried to put constants into banked page but it's not working, it > doesn't crash but the application dosn't work very well. I think that > values of constants are not good. > > Have you got an idea to put this constants into baked page ??? I suppose it dependes on the compiler, but here's another approach: some time ago when I wrote the code for banked MCS51 using IAR compiler, I had lots of static constants in banked pages that couldn't fit in single small non-banked page: in my case they were quite big calibration and linearization tables, and I had one special dedicated routine in non-banked memory that was able to retrieve value from any table from banked space using just index value for particular table. This routine directly manipulated the page selection and addressing to properly get to requested value at given offset into the table, regardless of the compiler idea of banking. But if you need lots of scalar values, then that's of no use ... -- Michal Konieczny mk@mk@....
An alternative approach is to put your constants in a specified page, and then place any function which uses those constants in the same page. You'll need to edit the linker file to define these spaces, and then put pragmas in your code to ensure that the code and constants are stored there. As a halfway-measure, you can have a single function in that page which copies the requested constant into RAM on demand, making the data available to any function that requires it, wherever that function may be stored. Steve Melnikoff. --- In 68HC12@68HC..., Michal Konieczny <0xmk@...> wrote: > > > I've tried to put constants into banked page but it's not working, it > > doesn't crash but the application dosn't work very well. I think that > > values of constants are not good. > > > > Have you got an idea to put this constants into baked page ??? > > I suppose it dependes on the compiler, but here's another approach: some > time ago when I wrote the code for banked MCS51 using IAR compiler, I > had lots of static constants in banked pages that couldn't fit in single > small non-banked page: in my case they were quite big calibration and > linearization tables, and I had one special dedicated routine in > non-banked memory that was able to retrieve value from any table from > banked space using just index value for particular table. This routine > directly manipulated the page selection and addressing to properly get > to requested value at given offset into the table, regardless of the > compiler idea of banking. > But if you need lots of scalar values, then that's of no use ... > > -- > Michal Konieczny > mk@... >
Hi Maxime. FYI: CodeWarrior provides C library runtimes to access banked/flashed data. Indeed, accessing banked data while running banked code should be done by an unbanked runtime, as the PPAGE gets "shared" by data and code (not especially in the same page, so you can imagine the code execution failure when changing PPAGE). If you plan to use banked (const) data, I propose you to see the delivered project in CodeWarrior V3.1 for HC(S)12 : Stationery\HCS12\Board Support\cml12s-dp256\cml12s-dp256_banked_data_code_and_const.mcp Regards, Gilles At 06:49 PM 2/7/2006, you wrote: >Hi everybody, > >I have to put an application and a bootloader in flash. >The bootloader is located from 0xE000 to 0xFFFF (non banked page) >The application is located form 0xC000 to 0xDFFF for ISR and >initialized data (variables and constants). >The page from 0x4000 is reserved. >But I have not enough place to put ISR code and initialized data from >0xC000 to 0xDFFF. > >I've tried to put constants into banked page but it's not working, it >doesn't crash but the application dosn't work very well. I think that >values of constants are not good. > >Have you got an idea to put this constants into baked page ??? > >Many thanks in advance. > > > > > > > >Yahoo! Groups Links > > > >
Thanks a lot everybody for your help. I put the const data in the same page than the code functions which uses this data. And it's working. See you later. --- In 68HC12@68HC..., Gilles Blanquin <gilles.blanquin@...> wrote: > > > Hi Maxime. > > FYI: > > CodeWarrior provides C library runtimes to access banked/flashed data. > > Indeed, accessing banked data while running banked code should be done by > an unbanked runtime, as the PPAGE gets "shared" by data and code (not > especially in the same page, so you can imagine the code execution failure > when changing PPAGE). > > If you plan to use banked (const) data, I propose you to see the delivered > project in CodeWarrior V3.1 for HC(S)12 : > > Stationery\HCS12\Board > Support\cml12s-dp256\cml12s-dp256_banked_data_code_and_const.mcp > > > Regards, > Gilles > > > At 06:49 PM 2/7/2006, you wrote: > >Hi everybody, > > > >I have to put an application and a bootloader in flash. > >The bootloader is located from 0xE000 to 0xFFFF (non banked page) > >The application is located form 0xC000 to 0xDFFF for ISR and > >initialized data (variables and constants). > >The page from 0x4000 is reserved. > >But I have not enough place to put ISR code and initialized data from > >0xC000 to 0xDFFF. > > > >I've tried to put constants into banked page but it's not working, it > >doesn't crash but the application dosn't work very well. I think that > >values of constants are not good. > > > >Have you got an idea to put this constants into baked page ??? > > > >Many thanks in advance. > > > > > > > > > > > > > > > >Yahoo! Groups Links > > > > > > > > >
--- In 68HC12@68HC..., Michal Konieczny <0xmk@...> wrote: > linearization tables, and I had one special dedicated routine in > non-banked memory that was able to retrieve value from any table from > banked space using just index value for particular table. This routine I got another idea similar to this, but doesn't require directly manipulating PPAGE. If a certain type of data is stored in a specific bank, you could place the retreive function in that bank. So when you call the fuction, maybe getPhoneNum(index, &val) then it will jump to "getPhoneNum" in the same bank where the numbers are stored, copy the number stored at that index, and then rtc. This could be simpler for many cases.