How can I read out the Program Flash frdm-kl27z

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

How can I read out the Program Flash frdm-kl27z

Jump to solution
871 Views
lorismichielutt
Contributor I

Hi,

 

I would like to read out the Program Flash.

The erase and write operations are OK!

 

in attach the example with KSD-3.0 and SDK 1.3

 

Any suggestions, thank.

 

B.R.

 

Loris

Original Attachment has been moved to: prjFrdmkl27z_deb_ledRGB_tim1_tpm_flash.zip

Labels (1)
0 Kudos
Reply
1 Solution
617 Views
DavidS
NXP Employee
NXP Employee

Hi Loris,

Are you only trying to access the Flash program space?

If yes, then you can do one of the following as you do not need any special flash read function call:

#define READ8(address)              ((uint8_t)(*(vuint8_t*)(address)))
#define READ16(address)            ((uint16_t)(*(vuint16_t*)(address)))
#define READ32(address)            ((uint32_t)(*(vuint32_t*)(address)))

for example, you can use the following code to access flash no matter whether the flash save data or code.

uint16_t value, i, *pSrc, *pDest;

pSrc=0xxxxxxxx;

value=READ16(pSrc);

pSrc++;

OR

   unsigned int *read_flash;
   volatile unsigned int temp;
  
   read_flash = *((unsigned int *)0x0003FFE0);
   temp = ((unsigned int *)read_flash);

Regards,

David

View solution in original post

0 Kudos
Reply
2 Replies
617 Views
lorismichielutt
Contributor I

Thank so much.

B.R.

Loris

0 Kudos
Reply
618 Views
DavidS
NXP Employee
NXP Employee

Hi Loris,

Are you only trying to access the Flash program space?

If yes, then you can do one of the following as you do not need any special flash read function call:

#define READ8(address)              ((uint8_t)(*(vuint8_t*)(address)))
#define READ16(address)            ((uint16_t)(*(vuint16_t*)(address)))
#define READ32(address)            ((uint32_t)(*(vuint32_t*)(address)))

for example, you can use the following code to access flash no matter whether the flash save data or code.

uint16_t value, i, *pSrc, *pDest;

pSrc=0xxxxxxxx;

value=READ16(pSrc);

pSrc++;

OR

   unsigned int *read_flash;
   volatile unsigned int temp;
  
   read_flash = *((unsigned int *)0x0003FFE0);
   temp = ((unsigned int *)read_flash);

Regards,

David

0 Kudos
Reply