3 Replies Latest reply on Nov 29, 2017 10:10 AM by user_485795501

    how do you force function into ram section

    user_485795501

      I looked up some stuff with a search and it tells me to do  __attribute__( ( section(".data") ) ) returnVariable Function ( variables) {... }  and the compiler attempts to use this, but then gives me this warning.  prj.M0121: Ignoring changed section attributes for .data

       

      just wondering if there is easy way to fix this, or maybe someone can point me to the documentation on how to do this?    this is on a PRoC4 for EZ BLE so the code size is small  128K code space in flash, so I want to force some functions into ram as I am running out of Flash space.  I have 4K of free unused RAM to place some ROM/Flash functions into

        • 1. Re: how do you force function into ram section
          user_485795501

          OK doing more research, maybe I can't do what I want here,  I wanted to save space in ROM by placing functions in RAM,  however, using the data section places the code in both FLASH and then coppies to RAM for runtime,  doing a copy down and intializing variables,  however, all this information exists in flash/ROM when you burn the program in.   so in reality I can not save or regain ROM by placing functions into RAM,,  I can only run from RAM to gain speed/performance.  so this really doesn't help me for the fact that I am using 99% of Flash/ROM.  Looks like the only option I have is to add an external memory and connect it to I2C or SPI,  like a serial ROM and some how load this into my free RAM space at power up.   seems like a lot of work and added cost to regain 4K of codespace,   Even if i change to move code from data section (initialized) to the bss section (uninitialized) I still have the same problem,  I can not regain ROM space as this code is still located in ROM until after copy down happens

          • 2. Re: how do you force function into ram section
            bob.marlowe

            Did you already try switching from "Debug" build mode to "Release"? The optimization will reduce code space.

             

            Bob

            • 3. Re: how do you force function into ram section
              user_485795501

              Yes switching from Debug to Release did help regain about 4K of

              codespace, just enough for me.  Thanks,