[ell-i-developers] Re: Ellduino Emulator: Fixing issues for Linux (Ubuntu 12.04 LTS)

  • From: Pekka Nikander <pekka.nikander@xxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Mon, 17 Feb 2014 06:55:15 +0200

>> As Arduino is moving to arm-gcc 4.8.3 for Arduino Due, and we will be moving 
>> to arm-gcc 4.8 for our board-native binaries, for the emulator we must match 
>> that with an i386-gcc 4.8.x.  Or, actually, i386-gcc 4.7.x is enough. ... 
>> Hence, you have to install gcc 4.8.3-latest (or 4.7.latest) as a native 
>> compiler to your Linux, and compile the emulator with that.   
> 
> I had been confused with the compilers that we are using separately for board 
> (embedded) and 
> for emulator (native Linux compiler). You were right, I was using wrong 
> compiler for emulator (arm-gcc same as I used for board).
> 
> Now my path contains native gcc-4.7 g++-4.7: you may see lines below from CMD 
> linux

Excellent that we got that fixed so easily!

>> I tried building the gcc-4.8.x from source, but its not ready yet and seems 
>> to have dependencies and configuration issues that might need to be fixed 
>> manually and may need quit advanced level unix/linux shell/scripting 
>> knowledge. Luckily, I found the test-repositories from Ubuntu official 
>> websites and installed and configured easily the packages gcc&g++ version 
>> 4.7 as instructed by them in the website.

Good to know!  If you write a Wiki page of this, it would be good to place the 
links directly there.

> g++: error: unrecognized command line option ‘-mthumb’
> 
> When I remove -mthumb from platform.txt file (compiler.cflags.target=     
> -mcpu={build.mcu} -mthumb),

That's the right fix, IIRC.  Eero had the same problem before and fixed it, but 
somehow the fix got lost.

> g++ -c -std=c++11 -g -Os -Wall -ffunction-sections -fdata-sections 
> -fno-common -nostdlib  -DF_CPU=48000000L -DARDUINO=1.5.4 
> -DELLI_STM32F051_ELLDUINO -DARDUINO_ARCH_STM32 -DEMULATOR -D__STM32F051__ 
> -Dmain=emulated_main -I../emulator/inc -I../cores/arduelli 
> -I../system/stm32/inc -I../system/stm32/CMSIS/Include -I../variants/ellduino  
>   -c -o system_init.o ../system/stm32/src/system_init.c
> ../system/stm32/src/system_init.c: In function ‘void SystemInitPeripherals()’:
> ../system/stm32/src/system_init.c:113:50: error: cast from ‘const 
> SystemInitRecordArray*’ to ‘uint32_t {aka unsigned int}’ loses precision 
> [-fpermissive]

Now we are in real business!  This is the kind of problems that I'm expecting.

> Are these problems arising because of MAC related configurations for GCC or 
> due to MAC specific code? Or may be I am using 64-bit system and code runs on 
> 32-bit system ... In this particular case, what do you suggest?

I think you may be using a 64-bit compiler.  Please try to add -m32 back to the 
command line and see what happens.  Maybe also -march=i386.   It may also be 
some other problem, due to differences between the GCC settings in linux and 
Mac.  At least on the Mac the native compiler supports both 64-bit and 32-bit 
binaries, and those two flags select the 32-bit binaries.

But very good progress anyway!

--Pekka


Other related posts: