This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

variable in data segment of external memory are not getting initialized when done with declaration

when a variable is declared and initialized along with it globally, it should be going to data segment of external memory( as per linker script provided). the variable gets stored at the expected location in the external ram, but it is not getting initialized with the provided value. some junk value is found in the location. but when we change the location of data segment to internal ram(in the linker script), it works fine. I'm using softcore of Cortex, M-1.

Parents
  • Hi Josie,
    For getting your variables initialized, you need to run the routines in the internal library. keil wraps the init code. this happens when you jump to 'main' from startup.s. ie you should not change the jump to "__main" your custom main function name. the MDK has a set of routines that are called if it is specified "__main" only. it executes these routines on the jump to "__main" and then it jumps to you "main()"

Reply
  • Hi Josie,
    For getting your variables initialized, you need to run the routines in the internal library. keil wraps the init code. this happens when you jump to 'main' from startup.s. ie you should not change the jump to "__main" your custom main function name. the MDK has a set of routines that are called if it is specified "__main" only. it executes these routines on the jump to "__main" and then it jumps to you "main()"

Children