f32c / arduino

FPGArduino source

Home Page:http://www.nxlab.fer.hr/fpgarduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIPS gcc won't compile u8g, RISC-V compiles it

emard opened this issue · comments

commented

u8glib will not compile for MIPS gcc
actually compiles but mips-elf-objcopy fails

RISC-V compiles the same and works
tested on SSD1306 SPI (software)
in u8g.h section SW SPI, Arduino after teensy add this
#elif defined(__ F32C __) /* FPGArduino */
#define U8G_COM_SW_SPI u8g_com_arduino_std_sw_spi_fn
#define U8G_COM_ST7920_SW_SPI u8g_com_arduino_st7920_spi_fn

https://bintray.com/olikraus/u8glib/Arduino/view

u8glib_arduino_v1.18.1.zip
sha1: f90c3c338244ff872c9c94777d7d76be381788a6

In the Arduino IDE, import the ZIP library from the "Add Library" Menu.
compile any example .e.g. U8gLogo

.arduino15/packages/FPGArduino/tools/f32c-compiler/1.0.0/bin/mips-elf-objcopy -O binary /tmp/build5698330625315358907.tmp/U8gLogo.cpp.elf /tmp/build5698330625315358907.tmp/U8gLogo.cpp.bin
BFD: Warning: Writing section .init' to huge (ie negative) file offset 0xffffffff7fc00000. BFD: Warning: Writing section.text' to huge (ie negative) file offset 0xffffffff7fc0005c.
BFD: Warning: Writing section .rodata' to huge (ie negative) file offset 0xffffffff7fc0222c. BFD: Warning: Writing section.ctors' to huge (ie negative) file offset 0xffffffff7fc0228c.
BFD: Warning: Writing section `.sdata' to huge (ie negative) file offset 0xffffffff7fc02290.

commented

Here is a simple file that manifests this error
I have seen it on gcc 4.8 on linux 64-bit and it looks
like linker has some bug of wrong combination
of 32 and 64 bit integer arithmetic.

in f32c bitstream RAM can be remapped to address below 0x80000000 e.g. 0x10000000
using C_sdram_base = x"1"

In this case, the code can be compiled without above warnings but still it will not work.
Remapping: in boards.txt locate entries related to your board and change something like
fpga_esa11_7a35i_bram.menu.ramsize.32M.compiler.ld.extra_flags=--section-start=.init=0x80000000
to
fpga_esa11_7a35i_bram.menu.ramsize.32M.compiler.ld.extra_flags=--section-start=.init=0x10000000
error_manifest.txt

Something has to be done with compiler or linker to fix this

This should mask the ld bug: f32c/f32c@52d0fc0

commented

Marko found mips linker bug, this workaround fixes it
objcopy -R .rel.dyn
u8g and error_manifest now compile properly
haven't tested the u8g display myself but it
should work now as well as for RISC-V