Skip to main content
Graduate
March 27, 2024
Question

Ensure code running in RAM

  • March 27, 2024
  • 2 replies
  • 1003 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

    Graduate
    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.

    Graduate
    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.