Chibios in Windows Eclipse

Posted at 2015-11-12.

Earlier (at Tarlab), I tried to build ChibiOS 3.0.2 out of the box on a Windows 8.1 host. Later, I even got it to work by running make in msys shell.

I returned to the project once again and decided to try and get Windows Eclipse to build a demo and perhaps setup some changes or a project for myself. My setup is essentially the freshest tools thrown in and trying to combine them.

Software used (I really should write down where I got this stuff, bloody integrationless OS):

Problem is, I hit the same bug as before as Eclipse runs naked make.exe. After looking around, I opened a question about Eclipse and MSYS make on Stackexchange.

make all 
       0 [main] sh 5524 sync_with_child: child 2444(0x188) died before initialization with status code 0xC0000142
     22 [main] sh 5524 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
      0 [main] sh 188 sync_with_child: child 1152(0x188) died before initialization with status code 0xC0000142
     26 [main] sh 188 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
      0 [main] sh 5096 sync_with_child: child 3200(0x18C) died before initialization with status code 0xC0000142
     25 [main] sh 5096 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
      0 [main] sh 5232 sync_with_child: child 3820(0x184) died before initialization with status code 0xC0000142
     25 [main] sh 5232 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
make: Nothing to be done for 'all'.

After more poking around, I found another potentially ancient msys DLL in the WinAVR directory. That should not be in PATH and never get loaded, but replacing it with the one from MinGW made the problem disappear. Now, make runs fine from command line and Eclipse as well as msys sh.

22:45:01 **** Build of configuration Default for project RT-STM32F103-MAPLEMINI ****
make all 
Compiler Options
arm-none-eabi-gcc -c -mcpu=cortex-m3 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -DUSE_MAPLEMINI_BOOTLOADER=1 -ffunction-sections -fdata-sections -fno-common -flto -Wall -Wextra -Wundef -Wstrict-prototypes -Wa,-alms=build/lst/ -DCORTEX_USE_FPU=FALSE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/build.d -I. -I../../../os/common/ports/ARMCMx/devices/STM32F1xx -I../../../os/ext/CMSIS/include -I../../../os/ext/CMSIS/ST -I../../../os/rt/include -I../../../os/rt/ports/ARMCMx -I../../../os/rt/ports/ARMCMx/compilers/GCC -I../../../os/hal/osal/rt -I../../../os/hal/include -I../../../os/hal/ports/common/ARMCMx -I../../../os/hal/ports/STM32/STM32F1xx -I../../../os/hal/ports/STM32/LLD -I../../../os/hal/ports/STM32/LLD/DACv1 -I../../../os/hal/ports/STM32/LLD/GPIOv1 -I../../../os/hal/ports/STM32/LLD/I2Cv1 -I../../../os/hal/ports/STM32/LLD/RTCv1 -I../../../os/hal/ports/STM32/LLD/SPIv1 -I../../../os/hal/ports/STM32/LLD/TIMv1 -I../../../os/hal/ports/STM32/LLD/USARTv1 -I../../../os/hal/ports/STM32/LLD/USBv1 -I../../../os/hal/boards/MAPLEMINI_STM32_F103 -I../../../test/rt -I../../../os/hal/lib/streams -I../../../os/various main.c -o main.o

Compiling crt0_v7m.s
Compiling chcoreasm_v7m.s
Compiling crt1.c
Compiling vectors.c
Compiling chsys.c
Compiling chdebug.c
Compiling chvt.c
Compiling chschd.c
Compiling chthreads.c
Compiling chtm.c
Compiling chdynamic.c
Compiling chregistry.c
Compiling chsem.c
Compiling chmtx.c
Compiling chcond.c
Compiling chevents.c
Compiling chmsg.c
Compiling chmboxes.c
Compiling chqueues.c
Compiling chmemcore.c
Compiling chheap.c
Compiling chmempools.c
Compiling chcore.c
Compiling chcore_v7m.c
Compiling osal.c
Compiling hal.c
Compiling st.c
Compiling hal_queues.c
Compiling hal_mmcsd.c
Compiling pal.c
Compiling serial_usb.c
Compiling usb.c
Compiling nvic.c
Compiling stm32_dma.c
Compiling hal_lld.c
Compiling st_lld.c
Compiling pal_lld.c
Compiling usb_lld.c
Compiling board.c
Compiling test.c
Compiling testthd.c
Compiling testsem.c
Compiling testmtx.c
Compiling testmsg.c
Compiling testmbox.c
Compiling testevt.c
Compiling testheap.c
Compiling testpools.c
Compiling testdyn.c
Compiling testqueues.c
Compiling testsys.c
Compiling testbmk.c
Compiling shell.c
Compiling memstreams.c
Compiling chprintf.c
Compiling usbcfg.c
Compiling main.c
Linking build/ch.elf
Creating build/ch.hex
Creating build/ch.bin
Creating build/ch.dmp

   text    data     bss     dec     hex filename
  34465    1568    5499   41532    a23c build/ch.elf
Creating build/ch.list

Done

22:45:20 Build Finished (took 18s.211ms)

I updated references to os, test, and board like the using Eclipse doc says. (PROJECT_LOC does not refer to ChibiOS root by default, though.) This cleared a lot of the Eclipse code warnings. Some references still don't seem to check out.

I don't think I can use GDB with the Maple, but I might try that with J-link sometime. I could add dfu-util with the previous arguments as an external tool and run it, though. For some reason I also had to use Zadig to switch the driver over again. (See: Blog: Chibios Windows redux )

ch> info
Kernel:       3.0.1
Compiler:     GCC 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 224288]
Architecture: ARMv7-M
Core Variant: Cortex-M3
Port Info:    Advanced kernel mode
Platform:     STM32F10x Performance Line Medium Density
Board:        LeafLabs Maple Mini
Build time:   Nov 12 2015 - 23:34:54

Tests succeed as before.

More progress will have to wait for another day. So far, it's hard to see Eclipse providing much value here. Especially since it doesn't use the screen estate very efficiently. Despite that, the editor with its reference completions and things might come in handy. I recall CCS being relatively comfortable as IDE's go. Most of the good there was probably the integrated Debugging facilities in the tiva Launchpads.

Links