CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#org-ing an #inline function

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bart Diricx



Joined: 16 Sep 2010
Posts: 5

View user's profile Send private message

#org-ing an #inline function
PostPosted: Wed Sep 22, 2010 2:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 22, 2010 6:03 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 22, 2010 6:09 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 22, 2010 7:42 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 22, 2010 8:34 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 22, 2010 8:53 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group