Impossible to declare a 3 bytes sized pointer on QE128

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

Impossible to declare a 3 bytes sized pointer on QE128

Jump to solution
2,260 Views
Electronico
Contributor I
Hello !
 
I'm working with Code warrior 6.0 and I'm experimenting troubles on the S08QE128.
 
For my application, I need to declare a 3 bytes sized pointer in order to read data saved in paged flash memory.
 
I'm using the "banked" memory model.
 
Code warrior help tels to use the key word "__far" in pointer declaration to declare a 3 bytes sized pointer, but it doesn't work, the pointer remains on 2 bytes only.
 
I also tryed to use the key word "__linear" : it seemed to work at first sight because the pointer had been well resized on 3 bytes, but the compiler failed with C4007 error telling "pointer deref is not allowed"...
 
Do you have any idea ?
 
Thank you very much for your help !
 
Electronico
Labels (1)
Tags (1)
0 Kudos
1 Solution
719 Views
Navidad
Contributor III
Hi,

When using the banked memory model all the function pointers are 3-byte wide. As for __linear pointers, you can use them to store linear addresses (the memory model has no influence upon their size), but dereferencing is not supported. In order to access the data you need to make use of  the macros defined in mmu_lda.h (located in lib/hc08c/include in your CW distribution) or write some inline assembly. Please take a look at the example from this thread (the example is actually included in version 6.1).

View solution in original post

0 Kudos
3 Replies
720 Views
Navidad
Contributor III
Hi,

When using the banked memory model all the function pointers are 3-byte wide. As for __linear pointers, you can use them to store linear addresses (the memory model has no influence upon their size), but dereferencing is not supported. In order to access the data you need to make use of  the macros defined in mmu_lda.h (located in lib/hc08c/include in your CW distribution) or write some inline assembly. Please take a look at the example from this thread (the example is actually included in version 6.1).
0 Kudos
719 Views
Electronico
Contributor I
Hi Navidad,
 
Thank you for your answer.
 
I'm going to try those macros defined in that file.
 
On my previous project, I worked on an HCS12, and the "far pointers" mechanism made me suffer a lot, but at the end was reliable and easy to use.
 
It's why I didn't thought about using another way of accessing data in paged memory.
 
Without your help, it would have taken a long time to me before I found that other solution !
 
Thank you again !
 
Bye,
 
Electronico
0 Kudos
719 Views
CrasyCat
Specialist III
Hello
 
You can find a sample project using string constants stored in banked ROM.
Look at {Install}\(CodeWarrior_Examples)\HCS08\Evaluation Board Examples\DEMOQE128\DEMOQE128_LAP_Dictionary.
 
CrasyCat