You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by kenneth akiti <ke...@gmail.com> on 2021/02/04 10:00:07 UTC

How to make board specific drivers on nuttx

Hello, I’m a newbie to nuttx, I’m using the maix-bit board which has the
k210(RISCV) by ‘sipeed.com’.

I tried to use the examples in the apps folder, but apparently I need to
make the drivers for the K210 board.

Please can I get help on how to make the drivers for a specific board, in
this case the k210 based boards?
-- 
 THE KENTECH LANE.
BOX NW345
NSAWAM ,GHANA

Re: How to make board specific drivers on nuttx

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Kenneth,

Is it the LED example that you commented at LinkedIn? It is important
to always explain exactly what you are trying to do and how you are
trying to do.

If you want add support for LEDs to be controlled by applications you need:

1) map the GPIO pins you are planing to use;

2) Create a boards/risc-v/k210/maix-bit/src/k210_userleds.c file.
It is not difficult, just use the
boards/arm/stm32/stm32f4discovery/src/stm32_userleds.c as reference
replacing the stm32_gpio* with k210_gpiohs_* ;

3) Modify the boards/risc-v/k210/maix-bit/src/Makefile with it:

ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += k210_leds.c
else
CSRCS += k210_userleds.c
endif

4) Run "make menuconfig" and disable the usage of the LED for
diagnostic/boot status:

Board Selection --->
    [ ] Board LED Status support

5) Yet in menuconfig enable the LED Driver support:

Device Drivers  --->
    LED Support  --->
        [*] LED driver
        [*]   Generic Lower Half LED Driver

6) Also enable the led application to see the "blinking LED show"

Application Configuration  --->
    Examples  --->
        [*] LED driver example

That's all folks!

BR,

Alan

On 2/4/21, kenneth akiti <ke...@gmail.com> wrote:
> Hello, I’m a newbie to nuttx, I’m using the maix-bit board which has the
> k210(RISCV) by ‘sipeed.com’.
>
> I tried to use the examples in the apps folder, but apparently I need to
> make the drivers for the K210 board.
>
> Please can I get help on how to make the drivers for a specific board, in
> this case the k210 based boards?
> --
>  THE KENTECH LANE.
> BOX NW345
> NSAWAM ,GHANA
>