2020-05-13 11:58 PM
Based on Cosmic compiler document, I am trying to use #pragma to store the const object into flash memory region 0x17f80.
Even I have configured the liker config,
Then I have added below code in .c file.
#pragma section const {applflag}
const u32 appl_flag = 0xAA55AA55;
#pragma section const {}
But, I cannot see the value 0xAA55AA55 in the address.
Please find the linker file commands below for your reference.
# Segment ApplFlag:
+seg .applflag -b 0x17f80 -m 0x80 -n .applflag
Please correct me if I did any mistake.
2020-05-16 11:57 PM
On SDCC, this small test program works for me:
#include <stdint.h>
void main(void)
{
}
const uint32_t __at(0xfff0) test = 0x55aa55aa;
AFAIR Cosmic has something similar to SDCC __at.
2020-05-17 07:12 PM
s
2020-05-17 08:29 PM
Hi Philipp,
Thank you for the information.
If I use "const uint32_t __at(0xfff0) test = 0x55aa55aa", the programm is not compiling at all. By the way, I cannot see any such instruction like "__at()" in cosmic cross compiler document (The document is, "C Cross Compiler User’s Guide for ST Microelectronics STM8" version 4.4).
Here are the details of my dev environment I am using.
Dev tool: STVD development tool
Compiler tool: Cosmic tools
Now, I am following the below method.
From the same document, I have seen a linker section option that can fill a word into memory section and the option is,
But, still there a problem in using this. This linker option fills with the value till the end of memory. In this case, from 0x17ffc to 0x17fff with the value 0x55AA55AA.
I need to store in the mid of flash memory using #pragma.