‎12-18-2007
11:11 AM
2,775 Views

Electronico
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
1 Solution
‎12-18-2007
01:48 PM
1,234 Views

Navidad
Contributor III
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
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).
3 Replies
‎12-18-2007
01:48 PM
1,235 Views

Navidad
Contributor III
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
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).
‎12-18-2007
02:37 PM
1,234 Views

Electronico
Contributor I
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
‎12-20-2007
01:32 PM
1,234 Views

CrasyCat
Specialist III
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Reply
