[Gnuk-users] porting GNUK to other MCUs

NIIBE Yutaka gniibe at fsij.org
Tue Jun 23 02:18:35 UTC 2015


On 06/22/2015 10:33 AM, NIIBE Yutaka wrote:
> Yes, I think so.   Basically, we need three things.
> 
>  (1) Porting board specific things: clock, LED, etc.
>      This part would be easy, when you have a specification.
> 
>  (2) Porting Chopstx (the thread library) to Cortex-M4.
>      This part would not be that hard, as you describe.
> 
>  (3) Porting MCU specific things: USB controller and ADC converter
>      drivers.
>      This part takes time to understand the MCU.

Kaz Kojima kindly (re-)introduced the port for STM32 Primer2.  I think
that this is a good opportunity to explain the porting effort.

I think that the steps would be:

(1) The first target is chopstx/example-led, which blinks LED
    periodically.

    (1-1) You need a board definition under chopstx/board/,
          copying from similar one.

          Basically, there are three variants, currently:
	  STM32F0, smaller STM32F103 (with flash ROM size 1024)
          and medium STM32F103 (with flash ROM size 2048 and more GPIO)

    (1-2) You might need to modify chopstx/clk_gpio_init.c.

          This is an implementation of clock setting and GPIO
          initialization.

    (1-3) You might need to modify chopstx/entry.c.

          If exception/interrupt model is different, you need to
          modify this, too.

    (1-4) Then, try chopstx/example-led/.

          chopstx/example-led/sys.c include system service routines
	  for LED, flash ROM access, and USB initialization.

          You can just ignore things for flash ROM access and USB
          initialization and just implement the set_led function
	  with corresponding board definition.

    (1-5) If it works, great.  If not, you need to port
          chopstx/chopstx.c, the thread implementation.

(2) Next is porting chopstx/example-cdc/usb_stm32f103.c, the
    USB driver.

(3) Then, try NeuG standalone device by porting
    neug/src/adc_stm32f103.c (the ADC driver).

(4) When (1)..(3) is going well, Gnuk is mostly ready for you.
    I think that it's only modifying the help message in
    gnuk/src/configure and possibly the Makefile.
-- 



More information about the gnuk-users mailing list