This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137 Running from RAM.

Other Parts Discussed in Thread: HALCOGEN

Now I try to do same task as Martin.
i.e. I want to run my program from RAM .
I want to load .text section into ROM and run from RAM.
I know that the method is described in ARM Assembly Language Tools(spnu118o) and need to edit linker command file.
But I cannot understand. sorry...

Now I use default linker command file generated by HALCoGen.

MEMORY
{
VECTORS (X) : origin = 0x00000000, length = 0x00000020
FLASH0 (RX) : origin = 0x00000020, length = 0x0017FFE0
FLASH1 (RX) : origin = 0x00180000, length = 0x00180000
STACKS (RW) : origin = 0x08000000, length = 0x00001500
RAM (RW) : origin = 0x08001500, length = 0x0003EB00
}
SECTIONS
{
.intvecs : {} > VECTORS
.text : {} > FLASH0 | FLASH1
.const : {} > FLASH0 | FLASH1
.cinit : {} > FLASH0 | FLASH1
.pinit : {} > FLASH0 | FLASH1
.bss : {} > RAM
.data : {} > RAM
.system : {} > RAM
}

If anyone can, pls tell me concretely about editing linker command file.

  • In the simple case of copying functions to statically allocated RAM the linker and existing startup code can do almost all of the work. I have attached a sample .zip project. The function "RAM_routine()"  in the file "RAM_routine.c" is copied to RAM by the initialization routine because of these lines added to the link command file "sys_link.cmd".

    /* USER CODE BEGIN (4) */
    	.binit   : {} > FLASH0 | FLASH1
    	.runFromRAM : { RAM_routine.obj (.text) }
    		load = FLASH0 | FLASH1,
    		run = RAM,
    		table(BINIT)
    /* USER CODE END */
    

    8540.TMS570LS3137_RunFromRAM.zip

  • Thank you for reply!

    Is there methods that all .text section will be copied to RAM?
    Need I write about all objects like
    .runFromRAM : {XXX.obj (.text) }
    load = FLASH0 | FLASH1,
    run = RAM,
    table(BINIT)

    sorry poor English.
  • Yes, but if all .text sections are in RAM, there is no code to copy the instructions from FLASH into RAM. The vectors and the startup code should be in flash. Perhaps you can tell me what you are trying to do and I can give you better help.
  • I want to load .text section into ROM and run from RAM.
    Beacuse our application is small algorithm and it is needed to run faster.
    I thought that all instruction can be copied from FLASH into RAM(because small algorithm, i.e. code size is small), and it can run faster.
    Considering what you taught me, the vectors and the startup code(= Generated by HALCoGen) should be in flash and application code (= after main())can copy to RAM, right?
    Sorry, I'm new to embedded development, I might say strange things.
  • You can list multiple files for the part you want copied into RAM. Be careful that normal breakpoints in RAM will be overwritten by the __TI_auto_init() routine. Either use hardware breakpoints, or only set the breakpoints after running __TI_auto_init().

    /* USER CODE BEGIN (4) */
    	.binit   : {} > FLASH0 | FLASH1
    	.runFromRAM :
    	{
    		RAM_routine.obj (.text)
    		sys_main.obj (.text)
    	}
    		load = FLASH0 | FLASH1,
    		run = RAM,
    		table(BINIT)
    /* USER CODE END */
    

    If the number of files becomes large and difficult to manage, you can break the project into separate projects that do partial linking with a final link phase putting the startup code in flash and then your main code in flash to be copied to RAM.