How to read the address between bootloader and APP

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

How to read the address between bootloader and APP

Jump to solution
728 Views
chcd007
Contributor II

In my program, the Bootloader program starts at address 0 and then jump to app starts at address 0x6040. I need to read 4 bytes of address 0x6000 in the app routine. I used

vl32 = *((*uint32_t)0x6000);

or

vl8 [i] = * ((* uint8_t) (0 x6000 + i)); (i = 0... 3)

two way to read. The result is a reset of the MCU. How can I read the data of this address

 

Tags (3)
0 Kudos
1 Solution
723 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

the first expression can't be compiled - there must be some error message in build console (if it is copy/pasted code snippet). 

 

you can use for example:
data=*(uint32_t*)0x6000;

where data is 

uint32_t data;

 

or you can use memcpy function:
memcpy(target,(uint8_t*)0x6000,4);

where target is: 

uint8_t target[4];

 

Jiri

View solution in original post

0 Kudos
1 Reply
724 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

the first expression can't be compiled - there must be some error message in build console (if it is copy/pasted code snippet). 

 

you can use for example:
data=*(uint32_t*)0x6000;

where data is 

uint32_t data;

 

or you can use memcpy function:
memcpy(target,(uint8_t*)0x6000,4);

where target is: 

uint8_t target[4];

 

Jiri

0 Kudos