How can I read out the Program Flash frdm-kl27z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How can I read out the Program Flash frdm-kl27z

跳至解决方案
1,310 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,056 次查看
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 项奖励
回复
2 回复数
1,056 次查看
lorismichielutt
Contributor I

Thank so much.

B.R.

Loris

0 项奖励
回复
1,057 次查看
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 项奖励
回复