skyfex / zig-nrf-demo

Demonstrate Zig code on the nRF51/nRF52 microcontrollers
53 stars 4 forks source link

figure out how to avoid the objcopy build step #1

Open andrewrk opened 6 years ago

andrewrk commented 6 years ago

the point of the objcopy build step is to remove the ELF headers and dump the raw machine code, is that right?

maybe do we want that to be a build switch of zig, such as --raw-machine-code?

zig build-exe --raw-machine-code --static --target-os freestanding --target-arch thumb --target-environ eabihf --linker-script nrf51_xxaa.ld --verbose-link --assembly gcc_startup_nrf51.S test.zig

One of the goals of zig is that you wouldn't need to have GNU binutils installed.

skyfex commented 6 years ago

That would be a very nice feature for working with microcontrollers. You'd basically only need Zig and the programmer software then to get started.

You wouldn't want to replicate all of objcopy of course, but if you have option for outputting a pure binary file or a hex file (there are different formats, but I think Intel HEX is the most common), that would cover 99% of use cases.

It might be nice to be able to output both ELF and BIN/HEX, as ELF can contain debugging symbols and such.