I have a code for an embedded microncontroller in an FPGA that contains variables stored in the stack and I would like to seperate the code from those variables and put those into 2 ELF files. The goal in the end is to convert the ELF files into intel hex format and initialize 2 distinct RAM with them.
The goal in the end is to have an Harvard architecture (i.e an architecture with a memory for the data and a memory for the program itself)
Right now I have a makefile with this rule:
%.hex: %.elf
$(OBJCOPY) -j .data -O ihex $^ [email protected]
$(OBJCOPY) --remove-section .data $^
$(OBJCOPY) -O ihex $^ $@
Here I create a single ELF and then extract the .data section into a seperate intel hex file. Then I remove the .data section from the original ELF and convert it to intel hex format. My problem is that this doesn't seem to be right as removing the section from the original elf relocate the next section in the file to a new position, which I guess is not something I want.