Reading data from banked flash location

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

Reading data from banked flash location

Jump to solution
572 Views
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?

Labels (1)
Tags (1)
0 Kudos
1 Solution
399 Views
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.

View solution in original post

0 Kudos
2 Replies
400 Views
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 Kudos
399 Views
vojislavbandobr
Contributor I

Thank you!

0 Kudos