Where to place source files for Board, CPU and UART driver
Gedare Bloom
gedare at rtems.org
Wed Jul 31 15:07:51 UTC 2013
In brief, the include files are relocated by the build system. The
magic is in the Makefile.am files, which specify various HEADERS and
their locations. Probably if you study some of the other BSPs in the
ARM family you will get some ideas. You will have to look at those
files to determine how the header is referenced. In general, this
header situation is troublesome and is being worked on to make
simpler.
When you change/add headers in Makefile.am you usually have to run
bootstrap -p i order to regenerate the preinstall.am file, which does
some of the heavy lifting of copying headers into their respective
locations in the build tree. It is all a mess.
-Gedare
On Wed, Jul 31, 2013 at 10:56 AM, R. Diez <rdiezmail-rtems at yahoo.de> wrote:
> 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
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
More information about the devel
mailing list