linker - GCC for ARM is linking in extra data -


i'm trying upload code onto lpc810, cortex-m0+ microcontroller. have simple progam i'm trying use, blinks led on , off.

typedef unsigned int volatile * vp;  int main() {     *(vp) 0x4000c1c0 = 0xffffffbful;     *(vp) 0xa0002000 |= 1 << 2;     for(;;) {         *(vp) 0xa0002300 |= 1 << 2;         volatile long wait = 240000;         while (wait > 0) --wait;     }     return 0; } 

edit: file called main.c.

i didn't write code, know works. problem when compile binary file upload, turns out on order of 75 kib! that's way large microcontroller.

after running size on elf file, there seems bunch of functions , data being linked in. i'm using newlib.

below makefile. i'm sure compiling/linking flags, i've been unable figure out.

program=hello arch=arm-none-eabi  cc=$(arch)-gcc cxx=$(arch)-g++ objcopy=$(arch)-objcopy objdump=$(arch)-objdump nm=$(arch)-nm size=$(arch)-size  flags=-pedantic-errors -wall -wextra -werror -wfatal-errors -o3 \     -fdiagnostics-color -mcpu=cortex-m0plus -mthumb cflags=-std=c11 $(flags) cxxflags=-std=c++14 $(flags) ldflags=  objects=./obj/main.o  all: ./$(program).hex  run: ./$(program).hex     sudo lpc21isp -wipe -verify -bin ./$(program).hex /dev/ttyusb0 115200 12000     make clean  ./$(program).hex: ./$(program).elf     $(objcopy) ./$(program).elf -o binary ./$(program).hex     $(objdump) -d $< > $(program).disasm     $(nm) -n $(program).elf > $(program).sym     $(size) $(program).elf  ./$(program).elf: $(objects)     $(cc) $(flags) $(ldflags) $^ -o $@  ./obj/%.o: ./src/%.s     $(cc) $(flags) -c $^ -o $@  ./obj/%.o: ./src/%.c     $(cc) $(cflags) -c $^ -o $@  ./obj/%.o: ./src/%.cpp     $(cxx) $(cxxflags) -c $^ -o $@  clean:     rm $(objects) ./$(program)* 

i'm generating binary file hex extension this, sorry confusion.

any thoughts on how fix this? help!

optimize binaries space -os, not -o3, strip symbols -s, , rid of stdc++ libraries linking in (std=c++14), that's not c++ program!


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -