ChibiOS Maple windows redux

Posted at 2015-10-12.

Earlier (at Tarlab), I tried to build ChibiOS 3.0.2 out of the box on a Windows 8.1 host. It didn't work. Now I tried the same from a shell launched with msys.bat and it appeared to run without error.

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

There no longer seems to be a flash_usb target despite what readme.txt says. Oh, well. Running dfu-util by hand should not be too hard, especially with my old notes.

$ dfu-util.exe -l
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Found DFU: [1eaf:0003] ver=0201, devnum=11, cfg=1, intf=0, alt=1, name="UNKNOWN" , serial="UNKNOWN"
Found DFU: [1eaf:0003] ver=0201, devnum=11, cfg=1, intf=0, alt=0, name="UNKNOWN" , serial="UNKNOWN"

I failed to flash using that, so I used Zadig and tried switching the driver to WinUSB (v6.1.7600.16385). Despite the name, that often seems to be the right choice.

$ dfu-util.exe -l
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Found DFU: [1eaf:0003] ver=0201, devnum=13, cfg=1, intf=0, alt=1, name="DFU Prog ram FLASH 0x08005000", serial="LLM 003"
Found DFU: [1eaf:0003] ver=0201, devnum=13, cfg=1, intf=0, alt=0, name="DFU Prog ram RAM 0x20000C00", serial="LLM 003"

Better. Let's flash.

$ dfu-util.exe -v -i0 -a1 -D build/ch.bin -R
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Invalid DFU suffix signature
A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download        [=========================] 100%        36040 bytes
Download done.
Sent a total of 36040 bytes
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is
present
Done!
Resetting USB to switch back to runtime mode

Neat! I wonder if it runs. I hit reset and COM6 appears. Putty in at 9600 bps, one enter and:

ch> help
Commands: help exit info systime mem threads test write
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:   Oct 12 2015 - 18:51:54
ch> mem
core free memory : 53464 bytes
heap fragments   : 0
heap free total  : 0 bytes
ch> threads
    addr    stack prio refs     state
2000250C 2000137C   64    1  SLEEPING
20002558 200025EC    1    1     READY
20001C20 20001D0C   64    1     READY
20002660 20002E2C   64    1   CURRENT
ch>

Interestingly, it says 3.0.1 despite my package saying 3.0.2. Grep agrees that 3.0.1 is all over the code while 3.0.2 is only mentioned in toplevel readme.txt changelog.

Finally, run tests:

ch> test

*** ChibiOS/RT test suite
***
*** Kernel:       3.0.1
*** Compiled:     Oct 12 2015 - 18:51:50
*** 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
*** Test Board:   LeafLabs Maple Mini

----------------------------------------------------------------------------
--- Test Case 1.1 (System, critical zones)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.2 (System, interrupts handling)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 1.3 (System, integrity)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.1 (Threads, enqueuing test #1)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.2 (Threads, enqueuing test #2)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.3 (Threads, priority change)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 2.4 (Threads, delays)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.1 (Semaphores, enqueuing)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.2 (Semaphores, timeout)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.3 (Semaphores, atomic signal-wait)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 3.4 (Binary Semaphores, functionality)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.1 (Mutexes, priority enqueuing test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.2 (Mutexes, priority return)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.3 (Mutexes, status)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.4 (CondVar, signal test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.5 (CondVar, broadcast test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 4.6 (CondVar, boost test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 5.1 (Messages, loop)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 6.1 (Mailboxes, queuing and timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.1 (Events, registration and dispatch)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.2 (Events, wait and broadcast)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 7.3 (Events, timeouts)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 8.1 (Heap, allocation and fragmentation test)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 9.1 (Memory Pools, queue/dequeue)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.1 (Dynamic APIs, threads creation from heap)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.2 (Dynamic APIs, threads creation from memory pool)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 10.3 (Dynamic APIs, registry and references)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Queues, input queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Queues, output queues)
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.1 (Benchmark, messages #1)
--- Score : 275851 msgs/S, 551702 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.2 (Benchmark, messages #2)
--- Score : 209904 msgs/S, 419808 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.3 (Benchmark, messages #3)
--- Score : 209904 msgs/S, 419808 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.4 (Benchmark, context switch)
--- Score : 887496 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.5 (Benchmark, threads, full cycle)
--- Score : 154500 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.6 (Benchmark, threads, create only)
--- Score : 234519 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.7 (Benchmark, mass reschedule, 5 threads)
--- Score : 67478 reschedules/S, 404868 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.8 (Benchmark, round robin context switching)
--- Score : 536296 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.9 (Benchmark, I/O Queues throughput)
--- Score : 580348 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.10 (Benchmark, virtual timers set/reset)
--- Score : 404670 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.11 (Benchmark, semaphores wait/signal)
--- Score : 1039700 wait+signal/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.12 (Benchmark, mutexes lock/unlock)
--- Score : 570292 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 12.13 (Benchmark, RAM footprint)
--- System: 336 bytes
--- Thread: 68 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
--- EventS: 4 bytes
--- EventL: 20 bytes
--- Mutex : 16 bytes
--- CondV.: 8 bytes
--- Queue : 36 bytes
--- MailB.: 40 bytes
--- Result: SUCCESS
----------------------------------------------------------------------------

Final result: SUCCESS
ch>

Great success! Now I wonder if I can convince Eclipse to use the mingw env for running make.

(later: Blog: ChibiOS in Windows with Eclipse

Links