ARM Technical Support Knowledge Articles

How do I use INCBIN to merge multiple binary images?

Applies to: DS-5

Answer

The ARM Compiler assembler (armasm) has a mechanism for embedding any file into an ELF section without the need to assemble it. The mechanism uses the INCBIN directive. The example below demonstrates how the INCBIN directive can be used to create a final ROMable binary consisting of a main application to be run on an ARM processor and a second application for running on a DMA engine.

dma_code.s

     area dma, code, readonly

     incbin dma.hex ; include file dma.hex in the current place.

     end

main.c

int main(void)
{

  /* main application */

  return 0;
}

scatter.txt

LR0 0x0
{
  APPLICATION_REGION 0x0
  {
    arm_code.o(+RO,+RW)
  }

  DMA_REGION 0x8000
  {
    dma_code.o(dma)
  }
}

build.bat

armcc -c main.c
armasm dma_data.s
armlink --entry foo --scatter scatter.txt --keep dma_code.o(dma) -o test.axf main.o dma_code.o
fromelf --bin -o test.bin test.axf

Related:

Article last edited on: 2014-07-31 08:41:28

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential