Reading data from banked flash location

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

Reading data from banked flash location

跳至解决方案
594 次查看
vojislavbandobr
Contributor I

Hi,

 

I have constants placed into PPAGE_6 and PPAGE_7 but I have problem to read them.

 

I tried standard:

 

(*(volatile unsigned char*)addr);

 

where addr is full address of byte location into flash (for example 0x68000), but I got data from other location.

 

I have used banked memory model.

 

MCU is MC9S08DZ128

 

Any Idea?

标签 (1)
标记 (1)
0 项奖励
1 解答
421 次查看
kef
Specialist I

Standard pointer can't be used to access banked data in CW. You have 3 choices:

1. switch PPAGE from routine in nonbanked flash, read data from PPAGEd flash.

2. manipulate linear address pointer registers (LAP) and read your data reading LWP, LBP and LB registers.

3. use CW linear data pointer and macros form mmu_lda.h . It is a pity this pointer is not the same like regular C pointer. You should study DEMOQE128_LAP_Dictionary example to find how to use it. Example was included in CW6.x examples folder. It seems it is not included any more in CW10.x. See attached.

Try using forum search. Subject was discussed few times already.

在原帖中查看解决方案

0 项奖励
2 回复数
422 次查看
kef
Specialist I

Standard pointer can't be used to access banked data in CW. You have 3 choices:

1. switch PPAGE from routine in nonbanked flash, read data from PPAGEd flash.

2. manipulate linear address pointer registers (LAP) and read your data reading LWP, LBP and LB registers.

3. use CW linear data pointer and macros form mmu_lda.h . It is a pity this pointer is not the same like regular C pointer. You should study DEMOQE128_LAP_Dictionary example to find how to use it. Example was included in CW6.x examples folder. It seems it is not included any more in CW10.x. See attached.

Try using forum search. Subject was discussed few times already.

0 项奖励
421 次查看
vojislavbandobr
Contributor I

Thank you!

0 项奖励