Archive 07/10/2020.

Kernel init - files not found

MDer

Hi,

I tried to check board_init() in file board/arduino-uno/board.c as explained but this file does not exist and I could hardly find any board.c file in other directories. I only found a board.h in include/.

Is it developer’s work to create this file if it is required ? Is it similar to setup() function in Arduino’s API ?

About core/init.c, does the developer has to change this file for customizing his application or this file must not be modified at all to avoid kernel bugs ? (kernel is said to be generic for all boards).

By the way, little mistake in the courses : the file core/init.c include kernel_init() function (but the file is not named kernel_init.c).

Thanks for the MOOC !
Marc

aabadie2

Hi,

The arduino uno boards shares a lot of code with other similar arduino boards. For this board, the board_init function is defined in boards/common/atmega/board.c.

Is it developer’s work to create this file if it is required ?

If the board is already supported by RIOT, this is not needed.

Is it similar to setup() function in Arduino’s API ?

Not really. The setup function in arduino just allows you to setup peripheral (uart, gpio) before entering the loop. But setup and loop functions are both called from the main function of the application, which is convenient but a bit limited:

  • arduino:
int main()
{
    setup();

    while (1) {
        loop();
    }
}
  • in RIOT:
int main()
{
    /* you have full control */
}