Skip to content

Enable compilation using gcc#18

Open
mrehkopf wants to merge 6 commits into
xvortex:mainfrom
mrehkopf:gcc-compat
Open

Enable compilation using gcc#18
mrehkopf wants to merge 6 commits into
xvortex:mainfrom
mrehkopf:gcc-compat

Conversation

@mrehkopf

@mrehkopf mrehkopf commented Oct 8, 2024

Copy link
Copy Markdown

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.

- LCD address is an integer, not a pointer
- correct data type format strings for sprintf
- 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`
- main function wasn't a prototype
- compiler independent __WEAK macro is used in diskio.h instead of __weak which is IAR specific.
This is used for headered firmware ELF creation in the project where this Makefile is derived from, and has no bearing here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant