VTXCart icon indicating copy to clipboard operation
VTXCart copied to clipboard

Enable compilation using gcc

Open mrehkopf opened this issue 1 year ago • 0 comments

I wanted to compile this but do not have access to IAR, so I made a few changes to enable compilation using arm-none-eabi-gcc.

Some fixes had to be made to the code itself in order to achieve this (I notoriously compile using -Wall), none of which should break IAR compilation:

  • lcd.c: LCD address is an integer, not a pointer
  • lcd.c: correct data type format strings for sprintf
  • fatfs: fp->buf / fs->win had previously been changed from an array into a pointer so the buffers can reside in 2nd SRAM; however sizeof then resolves to the size of the pointer itself, not the data; therefore sizeof ... is replaced with FF_MAX_SS (this was a real bug actually, independent of compiler)
  • main.c: main function wasn't a prototype
  • diskio.h: compiler independent __WEAK macro is used instead of __weak which was IAR specific. To pull in the compatibility headers, main.h is now included here.

Additionally,

  • a Makefile is added which I adapted from my sd2snes project.
  • a linkerscript and startup code compatible with gcc/ld are added.

mrehkopf avatar Oct 08 '24 13:10 mrehkopf