Skip to main content
Associate III
March 27, 2024
Question

Ensure code running in RAM

  • March 27, 2024
  • 2 replies
  • 1880 views

Ref: stm8s flash entire new program - how? - STMicroelectronics Community

How do I ensure that an entire routine, and anything that it might call, is running in RAM?  I think there is a RAM() macro around, for example, the flash write methods so can I place this around my own routine and will this "filter down" to all called routines or do these also have to be similarly flagged?

    This topic has been closed for replies.

    2 replies

    PHolt.1
    Senior
    March 27, 2024

    This is highly nontrivial. You need to learn the linkfile syntax and arrange for the RAM-based code to be linked to execute in RAM. Then you need to copy it there. I suggest searching eevblog.com for threads talking about RAM based loaders; I posted a load of sources there.

    Associate III
    March 27, 2024

    Thanks - will do.  I was particularly surprised to see that the `IN_RAM()` macro is a no-op for the COSMIC compiler.