Page 1 of 1

Integrating HAL into existing project

Posted: Fri Nov 15, 2019 11:22 pm
by Bugfinger
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
[font=monospace]os/hal/include/hal.h[/font] cannot find [font=monospace]board.h[/font]

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

And
[font=monospace]os/hal/osal/os-less/ARMCMx/osal.h[/font] cannot find [font=monospace]cmparams.h[/font] and [font=monospace]osalconf.h[/font].
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.

Re: Integrating HAL into existing project

Posted: Sat Nov 16, 2019 6:45 am
by Giovanni
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

Re: Integrating HAL into existing project

Posted: Sat Nov 16, 2019 8:44 pm
by Bugfinger
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