How do we align the output generated by IAR Embedded Workbench for ARM to 4 bytes automatically?

672 views Asked by At

I'm trying to get the output .hex file to have an automatic alignment to 4 bytes every time it is generated. Using ielftool would require me to have an additional manual step to calculate how many bytes I want to add so it's of no use. Also, setting the fill to the maximum file size would fix this but would mean that we would have to download the whole size (i.e. 256KB) even when the actual binary file is very small (i.e. 5KB).

1

There are 1 answers

0
sharpgeek On

It is possible to define a block with end alignment for the linker configuration.

One ".icf" stock configuration could be:

place in FLASH_region { readonly };

Suggested general solution, based on the stock configuration:

define block ROBLOCK with alignment = 4, end alignment = 4 { readonly };
place in FLASH_region { block ROBLOCK };

Using a block with end alignment should dynamically adjust as the application grows.