View previous topic :: View next topic |
Author |
Message |
Bart Diricx
Joined: 16 Sep 2010 Posts: 5
|
#org-ing an #inline function |
Posted: Wed Sep 22, 2010 2:21 am |
|
|
Hi,
When I call an #inline function from within another function which I placed in a defined memory segment (#org), the #inline function isn't placed in that memory segment.
I would think that the #inline function would be placed within the same memory segment as the calling function. I need that function to be placed within the defined segment for bootloader purposes.
I could #org that function to the bootloader memory segment, but then I get the following warning: Quote: | Warning 216 "bootloader.c" Line 434(0,1): Interrupts disabled during call to prevent re-entrancy: (writeEeprom) |
This is because my SSP ISR also calls the writeEeprom function.
Any suggestions ?
Best regards,
Diricx Bart |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 22, 2010 6:03 am |
|
|
Quote: | I would think that the #inline function would be placed within the same memory segment as the calling function. I need that function to be placed within the defined segment for bootloader purposes. |
Yes, I agree. But I don't understand, how this point is related to the re-entrancy warning. Generally, I would expect that your bootloader is created as a separate application with it's own set of CCS library functions, residing completely in the bootloader segment. Apparently, this isn't the case in your application, otherwise you won't have a choice to place a certain part of the bootloader here or there. |
|
|
Bart Diricx
Joined: 16 Sep 2010 Posts: 5
|
|
Posted: Wed Sep 22, 2010 6:09 am |
|
|
I don't use any of the build-in CCS library functions. I wrote my own EEPROM write function and I'd like to use the same function both from within my bootloader as well as my normal application. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 22, 2010 7:42 am |
|
|
Quote: | I wrote my own EEPROM write function and I'd like to use the same function both from within my bootloader as well as my normal application. |
This wasn't obvious from your question. But you should have two instances of writeEeprom in this case.
Quote: | I don't use any of the build-in CCS library functions. |
I was referring to library functions in general, including also functions that are implicitely use by the compiler. |
|
|
Bart Diricx
Joined: 16 Sep 2010 Posts: 5
|
|
Posted: Wed Sep 22, 2010 8:34 am |
|
|
Indeed, if I add the #inline option to writeEeprom and it's used on two places, I expect two instances in ROM as well. However if I look at the statistics in the generated .sta file, the writeEeprom isn't added to the bootloader memory segment... |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Sep 22, 2010 8:53 am |
|
|
As I mentioned previously, I expect a bootloader to be written as a separate application, that can be imported to the main application, if you want to make an all-in-one factory programming image. I don't think, that it will work in a different way. |
|
|
|