Defining table in Flash instead of RAM, IAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-06-11 7:36 AM
Hello,
Wondering if anyone has been able to use IAR to put a table in ROM memory instead of the default RAM with init table. I would like something like: code int a[] = {1,2,3,4,5,6} or int a[] @ ''abc'' = {1,2,3,4,5}, where abc could be defined in the linker. Thanks, AlphaWolfXV #iar #define #table #stm8- Labels:
-
IAR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-06-12 7:50 AM
In the embedded world, the ''const'' keyword is usually used to achieve this.
It places the qualified variable in the text segment, i.e. where the code is. Check the IAR help if they do something differently (the often do that...). And I vaguely remember you need access it at least once to keep the compiler from optimizing it out.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-06-12 8:03 AM
Raisonance:
code int a[] = {1,2,3,4,5,6}; Cosmic: const int a[] = {1,2,3,4,5,6}; IAR (I think) __code int a[] = {1,2,3,4,5,6}; Good luck- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-06-13 2:43 AM
IAR (I think)...
That all boils down to : RTFM I don't have a IAR installation, but I remember they have a decent help.... or int a[]
@
''abc'' = {1,2,3,4,5}, ... I would not do that if not absolutely necessary. Fixed addresses are for peripheral registers, reset and interrupt vectors, etc, which HAVE fixed addresses.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-06-13 2:58 AM
Thanks for the suggestions. Unfortunately IAR (for STM8) does not recognize the ''__code'' keyword. What's more is the help for IAR is not stellar for STM8; in the IAR for AVR parts there is mention of a ''__flash'' keyword, but no mention is made in the IAR for STM8 documentation. I will try the const method above and modify my calling functions.
Thanks for the help. Cyrus