Discussion Forum

"Embed" a file into my application

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Thomas Johansen
Posted
10-Jul-2009 10:08 GMT
Toolset
ARM
New! "Embed" a file into my application

Hi

I have trying to see if I could find any linker switch or code macro, to "import" a file from my PC into my resulting HEX/BIN/AXF file when building my application.

Is this possible.?

Perfered would be to have a variable(a pointer) to point to the imported data after the build.

/Thomas

Read-Only
Author
Tamir Michael
Posted
10-Jul-2009 10:19 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

As far as I know, the best you can do is either hard code the code, or use IAP.

Read-Only
Author
Thomas Johansen
Posted
10-Jul-2009 10:35 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

Mmhh.. ok

If I use IAP, I then has to, under production, first load my application. Then the application must load the needed binary data from some source(seriel, USB etc) and use IAP to store it.

I guess, it would be possible to first flash my program and then flash the binary data in a diffrent area of the MCU (or in a sperate sector)??

/Thomas

Read-Only
Author
Tamir Michael
Posted
10-Jul-2009 10:41 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

if you want to update the program itself, you will then have to either use a bootloader or run the flash procedure from a RAM based function. reset, collect the binary data and flash.

Read-Only
Author
Per Westermark
Posted
10-Jul-2009 11:13 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

Use a pre-build rule to run a helper program that converts your external file into a C code array like:

const char my_file[] = {
    0x15,0x17,0xfe,...
};
Read-Only
Author
Marcus Harnisch
Posted
10-Jul-2009 11:31 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

How about an assembler file containing an INCBIN directive?

http://infocenter.arm.com/help/topic/com.arm.doc.kui0100a/armasm_caccaghf.htm

Regards
Marcus
http://www.doulos.com/arm/

Read-Only
Author
Tamir Michael
Posted
10-Jul-2009 12:08 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

Cool Marcus, I didn't know that one!

Read-Only
Author
Thanking Zeusti
Posted
10-Jul-2009 12:34 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

HI.

that is good infomartion.

tnx.

Always yo're freind.

Zeusti.

Read-Only
Author
Per Westermark
Posted
10-Jul-2009 13:04 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

INCBIN was a really cool concept that I didn't know about.

The important thing here is that it is an ARM-unique method, so in case the used tools doesn't have anything similar, the fallback route would be to run a helper program that creates a source file with C or assembler constants.

Read-Only
Author
Komoto Takamura
Posted
12-Jul-2009 18:52 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

That's cool. Thanks Marcus

By the way. How can we reference it in the application itself. With native method we can reference it by variable containing binary data, so how can we treate file name as C variable?... Can anyone clearify?

Read-Only
Author
Per Westermark
Posted
12-Jul-2009 19:57 GMT
Toolset
ARM
New! RE: "Embed" a file into my application

Similar to how you let a C program access a variable declared in an asembler file, you should be able to specify a label before the include directive, and then in C have a extern declaration naming this label.

Next Thread | Thread List | Previous Thread Start a Thread | Settings