This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to generate an image with data[RW] only

Hi all, I am interested in an FLASH image(generated by MDK5 project) with only data[R/W] included. Also, I hope the image can be burned to any FLASH location(e.g., ox08008000). Could you provide me a sample project or a hint to generate this such project in Keil-MDK5.

The followings are my development environment information.

Development IDE: Keil-MDK5
MCU: STM32F429ZIY6

[File:data.h]

typedef struct Setting_{ unsigned int Ver; unsigned int DataA; unsigned int DataB;
} Setting,*pSetting;

[File:data.c]
#include "data.h"

Setting data={
{ .Ver = 0x00010000, .DataA = 0x01376790, .DATAB = 0x00007861
};

Request
To generate an Flash image located in 0x08001000 with size 4K, and the first 12 bytes are content of variable "data" as above.

  • I am interested in an FLASH image(generated by MDK5 project) with only data[R/W] included.

    There's no way that can work, for at least two reasons:

    1) FLASH just is not R/W.
    2) A C (or C++) program must always contain at least some code, by definition of the language.

    For what you appear to be trying to do, you'll have to make two changes to the plan: relax the requirement from "data[R/W]" to "constants[RO]", and replace the C compiler by a different binary file generation tool, e.g. use an assembler or create the hex file by hand.

  • Wouldn't a "Flash Image" of this nature be trivially easy to create as just a .HEX file? The Intel format is well documented, and not particularly complicated.

    If you want this data placement as part of a bigger application image, then you'd want to look at how to use scatter files, and place data within specific segments/sections thereof.

  • You can make this work pretty much as-is by telling armlink '--entry=data' and '--diag_warning=L6204E' (to stop it thinking that you don't know what you're doing).