How to decide the main application fixed address

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to decide the main application fixed address

Jump to solution
592 Views
fanziyu
Contributor IV

Hello everyone!
I have meet a problem when I read AN4723 for using bootloader,could you help me ?

MCU: S12ZVL64

Problem 1:In 4.1 "the application will jump to the main application. The main applicaiton must start at a fixed address configurable on the bootloader. " How to decide the main application fixed address?


//ROM = READ_ONLY 0xFF0000 TO 0xFFFDFF;//default
ROM = READ_ONLY 0xFF0200 TO 0xFFE5FF; //main application prm


if I configurate the prm file as shown above,then fixed address should be 0xFF0000 or 0xFF0200?  En, I think it is 0xFF0200,but i want to know the reason.

It is difficult for me to understand S12ZCPU_RM_V1 now, Would you please help to handle the case above ?thanks!

0 Kudos
1 Solution
579 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Fanziyu,

As described in AN4723 the ROM starts from top address 0xFFFFFF and goes down to 0xFF0000 for 64kB version. The RAM address starts on 0x001000 and goes up to 0x0013FF for 1k version (0x2000 for 4k version).

The Bootloader has two parts of code – one executed from FLASH and one executed from RAM (the code running during FLASH erase & write process). The last one takes one page (512 bytes). So it must be allocated in FLASH – segment SHADOW_ROM_S (512 b) and also in RAM segment SHADOW_RAM_S (512 b). The code is copied from FLASH to RAM and then executed. It is erase & write function.

This segment has to be in section:

SHADOW_ROM_S = READ_ONLY 0xFFFC00 TO 0xFFFDFF; // 512 bytes;

The Bootloader code executed from FLASH in in section:

ROM_BTLDR = READ_ONLY 0xFFF800 TO 0xFFFBFF;  // 1k bytes;

The rest of ROM is for user code section:

ROM = READ_ONLY 0xFF0000 TO 0xFFF7FF;  // 62k bytes;

For RAM the section for the Bootloader is:

SHADOW_RAM_S = READ_WRITE 0x001000 TO 0x0011FF;  // 512 bytes;

The rest of RAM is for user code:

RAM = READ_WRITE 0x001200 TO 0x0013FF;  // 512 bytes for smallest version;

After RESET the code starts from top FLASH – jump function to start address of Bootloader – this is fix address. The Bootloader code runs and waits 100msec for received data for FLASH program. If not received the time-out take place and program jump to top of FLASH section intended for user code. It is top of page beneath the Bootloader ROM section 0xFFF7FF. This configuration is independent of larger or smaller memory version device.

I hope it could help you to solve your task.

Best Regards,

Stano.

View solution in original post

0 Kudos
1 Reply
580 Views
StanoA
NXP TechSupport
NXP TechSupport

Hello Fanziyu,

As described in AN4723 the ROM starts from top address 0xFFFFFF and goes down to 0xFF0000 for 64kB version. The RAM address starts on 0x001000 and goes up to 0x0013FF for 1k version (0x2000 for 4k version).

The Bootloader has two parts of code – one executed from FLASH and one executed from RAM (the code running during FLASH erase & write process). The last one takes one page (512 bytes). So it must be allocated in FLASH – segment SHADOW_ROM_S (512 b) and also in RAM segment SHADOW_RAM_S (512 b). The code is copied from FLASH to RAM and then executed. It is erase & write function.

This segment has to be in section:

SHADOW_ROM_S = READ_ONLY 0xFFFC00 TO 0xFFFDFF; // 512 bytes;

The Bootloader code executed from FLASH in in section:

ROM_BTLDR = READ_ONLY 0xFFF800 TO 0xFFFBFF;  // 1k bytes;

The rest of ROM is for user code section:

ROM = READ_ONLY 0xFF0000 TO 0xFFF7FF;  // 62k bytes;

For RAM the section for the Bootloader is:

SHADOW_RAM_S = READ_WRITE 0x001000 TO 0x0011FF;  // 512 bytes;

The rest of RAM is for user code:

RAM = READ_WRITE 0x001200 TO 0x0013FF;  // 512 bytes for smallest version;

After RESET the code starts from top FLASH – jump function to start address of Bootloader – this is fix address. The Bootloader code runs and waits 100msec for received data for FLASH program. If not received the time-out take place and program jump to top of FLASH section intended for user code. It is top of page beneath the Bootloader ROM section 0xFFF7FF. This configuration is independent of larger or smaller memory version device.

I hope it could help you to solve your task.

Best Regards,

Stano.

0 Kudos