Where to place source files for Board, CPU and UART driver
R. Diez
rdiezmail-rtems at yahoo.de
Wed Jul 31 14:56:52 UTC 2013
Hi all:
I am finding it difficult to choose a place in the source tree for my new .c and .h files. In a previous message in this mailing list, I read that there is some potential confusion between libbsp and libcpu, but I'm not sure what to do now and I need to get further with my particular case.
I am developing a Board Support Package for an Arduino Due, which I've placed here on my PC:
c/src/lib/libbsp/arm/arduinodue/
The board has an AT91SAM3X8E microcontroller, but the UART driver is probably generic enough for the whole AT91SAM3 family (at least).
I tried placing that UART driver here:
c/src/lib/libbsp/arm/shared/include/arm-at91sam3x-uart-regs.h
c/src/lib/libbsp/arm/shared/include/arm-at91sam3x-uart.h
c/src/lib/libbsp/arm/shared/arm-at91sam3x-uart.c
This is what the existing driver for an 'arm-pl050' does.
However, both the BSP and that driver need a shared header file for the whole AT91SAM3 family, let's call it arm-at91sam3x-defs.h . The question is where that file should go. I tried this path first:
c/src/lib/libbsp/arm/shared/include
But the BSP does not reference it. In fact, the only additional include path while building the BSP seems to be:
c/src/lib/libbsp/arm/arduinodue/include
I had a look and it does seem that no BSP includes any header files under libbsp/arm/shared , which seems counterintuitive.
I tried place the file in that include file directory mentioned about, but that didn't compile (!). I have a question in this area. If you look at this file:
c/src/lib/libbsp/arm/stm32f4/include/rcc.h
You'll see the following statement:
#include <bsp/stm32f4.h>
However, file stm32f4.h lives here:
c/src/lib/libbsp/arm/stm32f4/include
And that path does not end in "bsp/", like in the #include statement above, so I do not understand how the compiler finds that include file.
Going back to my Arduino Due USART driver, I think I could add a new AT91SAM3 CPU type under libcpu instead, like this:
c/src/lib/libcpu/arm/at91sam3
I am looking at the existing at91rm9200 as an example.
The idea is as follows: the Arduino Due is a board, therefore it should have a Board Support Package. That BSP should reference the at91sam3 CPU, which lives under libcpu. I am not sure where to place the UART driver, maybe under libchip instead of under libbsp?
What's the best way to do this? I tried to find an example BSP under libbsp that references a CPU under libcpu, but couldn't find a link between any existing BSP and an existing CPU. Or does the user need to specify both a BSP and a CPU when configuring RTEMS?
Many thanks in advance,
rdiez
More information about the devel
mailing list