Impossible to declare a 3 bytes sized pointer on QE128

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

Impossible to declare a 3 bytes sized pointer on QE128

跳至解决方案
2,672 次查看
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
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,131 次查看
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 项奖励
回复
3 回复数
1,132 次查看
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 项奖励
回复
1,131 次查看
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 项奖励
回复
1,131 次查看
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