AnsweredAssumed Answered

IAR: cost of branching, how to place a method into RAM and would it improve performance?

Question asked by belomutskiy.andrey on Nov 22, 2014
Latest reply on Nov 24, 2014 by Clive One
I am trying to reduce the duration of my critical zones so I am checking which section of the code costs how many processor cycles.

I am looking at CYCCNT and it seems as if entering or exiting a method alone costs about 30 cycles? I wonder if that has something to do with reading from flash with a ART accelerator miss? So I wonder if placing some of my key methods into RAM would help.

How does this work? I have a section defined in my .icf:
 place in RAM_region                           {section .ram};

and I defined a method like
void m() @ ".ram" {
}

this compiles & links, but fails while flashing with an error saying that I am trying to write an address outside of the flash range. Which makes sense since RAM is not mapped into flash.

How does placing code into RAM work? Am I missing some attributes somewhere or would I have to copy the code from flash into ram manually? Does this have a chance to improve performance? Are there any penalties for going from flash execution into ram and back?


Outcomes