Hi all, when running make in tests directory, the linker got lost again because the path was at a deeper level... Now it is corrected (after Pekka accepts my pull request)! All in all tests went well, system didn't like _exit(0) so I just commented it away... void loop() { #ifdef EMULATOR // _exit(0); #endif } ./test_analogWrite: OK GPIO:MODER:0&=ffefffff GPIO:MODER:0|=200000 TIM:CCR3:0=0 GPIO:MODER:200000&=ffefffff GPIO:MODER:200000|=200000 TIM:CCR3:0=f GPIO:MODER:200000&=ffefffff GPIO:MODER:200000|=200000 TIM:CCR3:f=ff ./test_digitalRead: OK -rwxr-xr-x 1 eero eero 460409 Mar 4 20:44 test_digitalRead GPIO:PUPDR:0&=ffcfffff GPIO:MODER:0&=ffcfffff GPIO:IDR:ffffffff&400 ./test_digitalWrite: OK -rwxr-xr-x 1 eero eero 461323 Mar 4 20:44 test_digitalWrite GPIO:MODER:=100000 GPIO:BRR:=400 GPIO:BSRR:=400 ./test_pinMode: OK -rwxr-xr-x 1 eero eero 461467 Mar 4 20:44 test_pinMode GPIO:PUPDR:0&=ffcfffff GPIO:MODER:0&=ffcfffff GPIO:PUPDR:=40000 GPIO:MODER:0&=fff3ffff GPIO:PUPDR:=60000 GPIO:MODER:0&=fffcffff GPIO:MODER:=40000 ./test_Serial_begin: OK -rwxr-xr-x 1 eero eero 463714 Mar 4 20:44 test_Serial_begin GPIO:AFR:0=1000000 GPIO:MODER:0=20000000 GPIO:AFR:1000000=11000000 GPIO:MODER:20000000=a0000000 USART:BRR:=341 USART:CR1:a4|=9 ./test_Serial_write_uint8: OK -rwxr-xr-x 1 eero eero 464595 Mar 4 20:44 test_Serial_write_uint8 GPIO:AFR:0=1000000 GPIO:MODER:0=20000000 GPIO:AFR:1000000=11000000 GPIO:MODER:20000000=a0000000 USART:BRR:=341 USART:CR1:a4|=9 USART:TDR:=48 USART:ISR:80&80 USART:TDR:=65 USART:ISR:80&80 USART:TDR:=6c USART:ISR:80&80 USART:TDR:=6c USART:ISR:80&80 USART:TDR:=6f USART:ISR:80&80 USART:TDR:=a USART:ISR:80&80 ./test_SPI_begin: NOK, got errors test_SPI_begin.o: In function `SPIClass::begin(unsigned char) const': /home/eero/sw-engineering/sulautetut/eeronomarepo/Runtime/stm32/tests/../libraries/SPI/./SPIClass.h:83: undefined reference to `spi_master_begin' test_SPI_begin.o:(.rodata._ZL5SPI_2+0x4): undefined reference to `spimap2' test_SPI_begin.o:(.rodata._ZL3SPI+0x4): undefined reference to `spimap1' collect2: error: ld returned 1 exit status make[1]: *** [test_SPI_begin] Error 1 make: *** [test_SPI_begin] Error 2 -eero- On Tue, Mar 4, 2014 at 12:09 AM, Asif Sardar < engr.asif.sardar@xxxxxxxxxxxxxx> wrote: > I am facing same problem (Segmentation fault (core dumped)) with test > cases as well e.g. ~/Runtime/stm32/tests/ ... > > > On Mon, Mar 3, 2014 at 11:21 PM, Asif Sardar < > engr.asif.sardar@xxxxxxxxxxxxxx> wrote: > >> Great! >> >> I have also successfully made emulator with the above instructions and >> using 32 bit elf_i386.xc linker script ... >> >> However, running ./sketch, I got >> >> Segmentation fault (core dumped) -> I might be using older git clone with >> broken code. To update my local repository, would simple git pull from >> command line would work? >> >> However, the major problem is removed now ... >> >> >> >> >> On Mon, Mar 3, 2014 at 4:26 PM, Pekka Nikander <pekka.nikander@xxxxxx>wrote: >> >>> Success! >>> >>> Now, next I'll need a clean pull request... >>> >>> --P >>> >>> On 2014-03-03, at 15:39 , Eero Hakala <eero.k.hakala@xxxxxxxxx> wrote: >>> >>> > hahhaa, the problem was aktually in sketch.cpp... when I changed it to: >>> > >>> > #include <Arduino.h> >>> > >>> > void setup() {} >>> > void loop() {} >>> > >>> > So it didn't like those \n:s after all.... Now when running sketch I >>> get the output as: >>> > >>> > RCC:CR:200ff83|=1 >>> > RCC:CFGR:8&=f8ffb80c >>> > RCC:CR:200ff83&=fef6ffff >>> > RCC:CR:200ff83&=fffbffff >>> > RCC:CFGR:8&=ffc0ffff >>> > RCC:CFGR2:0&=fffffff0 >>> > RCC:CFGR3:0&=fffffeac >>> > RCC:CR2:ff80&=fffffffe >>> > RCC:CIR:=0 >>> > FLASH:ACR:=11 >>> > RCC:CFGR:8|=0 >>> > RCC:CFGR:8|=0 >>> > RCC:CFGR:8&=ffc0ffff >>> > RCC:CFGR:8|=280000 >>> > RCC:CR:200ff83|=1000000 >>> > RCC:CR:300ff83&2000000 >>> > RCC:CFGR:280008&=fffffffc >>> > RCC:CFGR:280008|=2 >>> > RCC:CFGR:28000a&c >>> > InitRecord: 804a888 type: 0 count: 1 >>> > RCC:AHBENR:14=400014 >>> > InitRecord: 804a89c type: 0 count: 1 >>> > RCC:AHBENR:400014=500014 >>> > ... >>> > >>> > >>> > >>> > -eero- >>> > >>> > >>> > On Mon, Mar 3, 2014 at 2:58 PM, Pekka Nikander <pekka.nikander@xxxxxx> >>> wrote: >>> > Great! >>> > >>> > cd build >>> > rm sketch.cpp >>> > make sketch.cpp >>> > make PLATFORM=emulator >>> > >>> > Results? >>> > >>> > --Pekka >>> > >>> > On 2014-03-03, at 14:44 , Eero Hakala <eero.k.hakala@xxxxxxxxx> wrote: >>> > >>> > > Hi, I took the 32bit linker script, added same stuff as Asif and >>> saved it into scripts-directory. >>> > > >>> > > Then I changed the flags in emulator.mk like Pekka instructed: >>> > > >>> > > # LDFLAGS := -m32 -demangle >>> > > LDFLAGS := -m32 -demangle -march=i386 -Xlinker -T -Xlinker >>> ../scripts/elf_i386.xc >>> > > >>> > > And got rid of previous errors, but it hang up in main: >>> > > g++ -m32 -march=i386 -m32 -demangle -march=i386 -Xlinker -T -Xlinker >>> ../scripts/elf_i386.xc -o sketch main.o sketch.o ellduino.o "-L." >>> "-L../variants/ellduino" "-lstm32f0" -lstdc++ >>> > > main.o: In function `emulated_main': >>> > > >>> /home/eero/sw-engineering/sulautetut/ng-ell-i/Runtime/stm32/build/../cores/arduelli/main.cpp:36: >>> undefined reference to `setup()' >>> > > >>> /home/eero/sw-engineering/sulautetut/ng-ell-i/Runtime/stm32/build/../cores/arduelli/main.cpp:38: >>> undefined reference to `loop()' >>> > > collect2: error: ld returned 1 exit status >>> > > >>> > > -eero- >>> > > >>> > > >>> > > >>> > > On Sun, Mar 2, 2014 at 9:56 PM, Pekka Nikander < >>> pekka.nikander@xxxxxx> wrote: >>> > > > You were right... the default linker script that GNU 'ld' uses >>> resides inside /usr/lib/ldscripts named as elf_x86_64.xc. It is also >>> attached to this email with lines 61-64 added about start and end >>> peripherals ... >>> > > >>> > > I think that is the 64-bit linker script. I *guess* the 32-bit one >>> might be elf_i386.xc >>> > > >>> > > > Please see the changed elf_x86_64.xc file attached to this e-mail. >>> > > >>> > > That looks perfectly good to me. >>> > > >>> > > My guess is that once you find the right i386 linker script, and get >>> it working from the command line with the -m32 -march=i386 -Xlinker -T >>> -Xlinker <your-file> arguments, you'll be done with this. >>> > > >>> > > --Pekka >>> > > >>> > > >>> > > >>> > >>> > >>> > >>> >>> >>> >> >> >> -- >> >> >> >> *With Best Regards,Asif Sardar.+358 43 8265795 <%2B358%2043%208265795> * >> > > > > -- > > > > *With Best Regards,Asif Sardar.+358 43 8265795* >