This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

A small timer_handler from RAM?

I have a timer that wakes up every 20ms to read twi.

Unfortunately it takes 4.4mA for the CPU to execute code from flash.

I would like to reduced the current consumption by executing the code from RAM 2.4mA. It would be better to use the EasyDMA to read twi. But that does not appear to be possible?

If it is possible to load the code for the small timer_handler into RAM? How is this done? Are there any examples of this?

Parents
  • This works in GCC:

    void __attribute__((section(".data"))) functionInRam(void) {
    

    The linker complained about changin attributes for .data but the code run just fine. I used to make a fast flash write function. 8 words took 0.37ms when run from flash, but only 0.21ms when placed in RAM. This included the wait for the flash write to finish.

    Hope that can help.

    Best regards, Andreas Wileur

Reply
  • This works in GCC:

    void __attribute__((section(".data"))) functionInRam(void) {
    

    The linker complained about changin attributes for .data but the code run just fine. I used to make a fast flash write function. 8 words took 0.37ms when run from flash, but only 0.21ms when placed in RAM. This included the wait for the flash write to finish.

    Hope that can help.

    Best regards, Andreas Wileur

Children
No Data
Related