cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute code form inter RAM without JTAG?

scoollau
Associate II
Posted on December 23, 2009 at 07:52

How to execute code form inter RAM without JTAG?

8 REPLIES 8
scoollau
Associate II
Posted on May 17, 2011 at 13:26

Hi all,

We can excute code in RAM with JTAG, and debug it

we only need to do flowing steps

1> Setup IROM1 start address: 0x20000000 size:0x3000

IRAM1 start address: 0x20003000 size:0x1000

2> Load Ram.ini file while debuging

===========================================

FUNC void Setup (void) {

SP = _RDWORD(0x20000000);

PC = _RDWORD(0x20000004);

_WDWORD(0xE000ED08, 0x20000000);

}

LOAD xxxx.axf INCREMENTAL

Setup();

g, main

===========================================

So, the programming is running in the interal ram

But, what I want to do is:

1> boot from system memory

2> communite with system bootloader and download program into ram

3> Excute GO command to execute code in the RAM

So, these are what I should do:

1> Setup IROM1 start address: 0x20000000 size:0x3000

IRAM1 start address: 0x20003000 size:0x1000

2> setup the Linker property page

R/O base: 0x20000200

R/W base: 0x20003000

3> Set vector table in ram:

NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x200);

4> Download program to 0x20000200 and execute GO command with this address

The turth is command is execeuted, but the program still not run

I have tried this way in flash memory, and successed

What I gonna do if I want to execute code in RAM memory?

Waiting for your help

🙂

scoollau
Associate II
Posted on May 17, 2011 at 13:26

Can't anybody answer my question?

Come on~

scoollau
Associate II
Posted on May 17, 2011 at 13:26

Thank you for you replying!

Yes I use interrupts in the code

I try it in the flash memory in the same way and it success

I mean I setup the start address of the Flash as 0x08000000,

and set interrupt vector: NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0);

NVIC_VectTab_FLASH is defined with 0x08000000

For RAM memeory:

I also try execute GO command from address 0x20000200 + 4

and it still not work

BTW,the bootloader version is 2.1

How should setup SP?

Waiting for your help...

🙂

tomas23
Associate II
Posted on May 17, 2011 at 13:26

Do you use interrupts in the code? How do you setup the stack? How old is the MCU (rather, which version of bootloader?)

The bootloader

I can see that your SP is at beginning of RAM, it shall point to end of your RAM stack area instead!

Please try a simple loop with some LED blinking first.

tomas23
Associate II
Posted on May 17, 2011 at 13:26

If your vector table is linked correctly, do it in your start-up code VERY soon: take the first word of vector table and move to SP. This makes the SP initialized according to your linker parameter file.

scoollau
Associate II
Posted on May 17, 2011 at 13:26

Thank you for your reply

I really appreciate it

Could you specify the steps, I am a novice in this area

Thank you~

mcuisp
Associate II
Posted on May 17, 2011 at 13:26

I'd got a patent about this issue

chikos33
Associate II
Posted on May 17, 2011 at 13:26

Hi scoollau,

I had tried a similar thing before. I'm not sure, but I think that you can't use the first 4KB/2KB of internal RAM for your code since this part is already used by the bootloader itself?

I think that you should set your IROM1 at something like 0x20001000 to avoid overwriting bootloader data. Am I right ?

Then, I think that when executing the GO command you should enter the start address not the SP address, (ie. 0x20001000 not (0x20001000 + 4)). that's what I've done anyway, and it seems working.

I hope it goes better for you :D