STM32F4 problem with TFT_ILI9163 128x160

Hm OK I got the compilation working with a few hacks. Repo: GitHub - maxgerhardt/pio-stm32-ili9163C: An example of using the ILI9163C display with the STM32 Arduino Core

Changes:

  • remove include <wiring_private.h> in TFT_ILI9163C.cpp. The needed definitions are already pins_arduino.h.
  • remove the same type of include from the Adafruit GFX library code

I guess this library just isn’t exactly made for the STM32 version of the Arduino Core.

Morever, when building you’ll get an error that the symbol end is not defined but is needed by sbrk.c, which responsible for heap management (malloc()). The linker script has a “bug”. It doesn’t define the symbol end but the symbol _end. I will open an issue in PlatformIO for this. You need to fix that now by doing the following:

Go into your PlatformIO home folder (C:\Users\<user>\\.platformio for Windows, /home/<user>/.platformio for Linux/Mac). Then to packages\framework-arduinoststm32\STM32F4\variants\generic_f407v\ld. Edit the file common.inc.

There is a section that reads

    .bss :
      {
        . = ALIGN(8);
        __bss_start__ = .;
        *(.bss .bss.* .gnu.linkonce.b.*)
        *(COMMON)
        . = ALIGN (8);
        __bss_end__ = .;
        _end = __bss_end__;
      } > REGION_BSS

You need to change it to the following:

    .bss :
      {
        . = ALIGN(8);
        __bss_start__ = .;
        *(.bss .bss.* .gnu.linkonce.b.*)
        *(COMMON)
        . = ALIGN (8);
        __bss_end__ = .;
        _end = __bss_end__;
        end = _end;
      } > REGION_BSS

Then it will compile.