|
|
View previous topic :: View next topic |
Author |
Message |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
Penalty for accessing constant strings stored in ROM |
Posted: Sat Jan 09, 2016 2:45 am |
|
|
Folks,
I've noticed that standard string functions ( strncmp(), for example) take longer to execute when one of the parameters is a constant string stored in Flash. I have the pass strings in RAM directive. Is there a time penalty for accessing constant strings that are stored in Flash?
In the meantime, I'll do a workaround where I temporarily "cache" the strings in RAM for quick access. I happen to have enough RAM for that.
Cheers,
- Nick and his PIC18LF4550 _________________ Read the label, before opening a can of worms. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Jan 09, 2016 4:16 am |
|
|
Yes. Of course.....
Data has to be read from the ROM to RAM, and then accessed in the RAM.
Because the 'pass strings' operator, is trying not to use too much RAM, it only uses a tiny buffer, so several successive reads.
If you instead just copy the string to RAM, only a single RAM access has to be done.
TANSTAAFL.
Editing.
This is why I don't use pass_strings=IN_RAM, but instead keep with having to use the separate const or ROM if I want to use pointers. If I want to access something in RAM I just copy it to RAM.... |
|
|
|
|
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
|