Integrating HAL into existing project

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Bugfinger
Posts: 2
Joined: Fri Nov 15, 2019 11:03 pm

Integrating HAL into existing project

Postby Bugfinger » Fri Nov 15, 2019 11:22 pm

Hi,

I am a beginner in embedded software and am trying to integrate Chibi HAL into a small existing project.
I am reading http://www.chibios.org/dokuwiki/doku.ph ... tion_guide which leads me to an error possibly rooted in a misunderstanding.

The project does not use any OS and it's on an STM32F412CE.

So when I followed the steps from the wiki page, I get errors about missing include files.
Especially
os/hal/include/hal.h cannot find board.h

This strikes me as odd because board.h can only be found in the board-specific headers, which I do not use due to the custom board.

And
os/hal/osal/os-less/ARMCMx/osal.h cannot find cmparams.h and osalconf.h.
Both files are not mentioned in the wiki. Also I cannot find the former and the latter is just there in one of the demos.

Where did I take the wrong turn?

Thanks.

User avatar
Giovanni
Site Admin
Posts: 12296
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 590 times
Been thanked: 504 times
Contact:

Re: Integrating HAL into existing project

Postby Giovanni » Sat Nov 16, 2019 6:45 am

Hi,

The guide is not very updated, now the OSAL has a configuration file. Take it from ./demos/STM32/HAL-STM32F407-DISCOVERY/cfg and place it in your project.

The file cmparams.h is the wrapper around vendor CMSIS headers, you need to include the one for your device, look into ./os/common/startup/ARMCMx/devices, usually our startup files include this so there is no need to do that explicitly, apparently you are using different startups.

About board.h, you need to create board files for your custom board, initialization is done using those definitions. An explanation is here: https://www.playembedded.org/blog/port- ... -platform/

Another note, there is a known bug in OSAL, please use the HAL code from repository trunk, where the bug is already fixed.

Giovanni

Bugfinger
Posts: 2
Joined: Fri Nov 15, 2019 11:03 pm

Re: Integrating HAL into existing project

Postby Bugfinger » Sat Nov 16, 2019 8:44 pm

Hi,

thank you for your answer.

Giovanni wrote:The guide is not very updated, now the OSAL has a configuration file. Take it from ./demos/STM32/HAL-STM32F407-DISCOVERY/cfg and place it in your project.


Done.


Giovanni wrote:The file cmparams.h is the wrapper around vendor CMSIS headers, you need to include the one for your device, look into ./os/common/startup/ARMCMx/devices, usually our startup files include this so there is no need to do that explicitly, apparently you are using different startups.


I added os/common/startup/ARMCMx/devices/STM32F4xx to the build system's include dirs.


Giovanni wrote:About board.h, you need to create board files for your custom board, initialization is done using those definitions. An explanation is here: https://www.playembedded.org/blog/port- ... -platform/


I will go for this tomorrow.


Giovanni wrote:Another note, there is a known bug in OSAL, please use the HAL code from repository trunk, where the bug is already fixed.


Done.

Thanks again. I hope I will be successful with the board file. :)

Cheers


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 1 guest