Hello guys
I am recently employed in a company that uses STM32 microprocessors for some of their products.
So far they have managed by using their own system but I see some limitations by it. Mostly because I am used to higher level of programming so threads and "parallelism" are things I value highly.
During my studies I have met FreeRTOS and I have now studied the different RTOS on the market. It seems ChibiOS is among if not the best choice.
I therefore want to do some preliminary studies and try porting ChibiOS to our platform but I find it difficult to get started. I am not the big expert on embedded development and with FreeRTOS I had the pleasure of "Using The FreeRTOS Real Time Kernel - A Partical Guide".
First of all there is the board setup ( Can't see any in 3.0 ). It is told just to copy one and edit but I am missing some details on some of the functions and declarations.
Like the FreeRTOS guide I am also miss a short introduction to the fundamental/mostly used functions.
I might have missed something and maybe I am asking too much. But if you have any word of advice or link to guides that are useful I would be more than happy.
Thanks.
Regards
Aslund
Getting started with ChibiOS ( Newbie question )
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Getting started with ChibiOS ( Newbie question )
Hi,
In ChibiOS the support for STM32 is very complete, basically you just need to port the OS to a different board (your target).
I recommend using one of the included demos for a while, you just nead a cheap Discovery or Nucleo board. This will allow you to test everything very quickly, you could download ChibiStudio for a very quick startup.
I am describing the organization for ChibiOS 3.0, it is slightly different for previous versions, you are starting now so 3.0 should be your target. In order to create your project:
Step 1 - Creating new board files
Under ./os/hal/boards there is a directory for each supported board. Copy one of the boards to a new directory, choose a board with the same device you need. You will have for example ./os/hal/boards/myboard.
Step 2 - Modifying board files
Each directory contains always the same files:
myboard/cfg/board.chcfg <- It is an XML file
myboard/board.c
myboard/board.h
myboard/board.mk
The CHCFG file is an XML description of your board: Initial GPIO settings, clock frequency, used device. Using a tool included in ChibiStudio you can generate the .h/.c/.mk files starting from CHCFG file. In ChibiStudio there is a guided XML editor, changing the CHCFG file is driven by a schema so it is not easy to do it wrong. Optionally you can edit board.h manually, it is not difficult but not the preferred way.
Step 3 - Create your application
Clone one of the demos using the same device into another directory: ./demos/myproj. You can use any path but lets start simple.
Open .project and .cproject in an editor and search/replace the project name with your name. Import the new project in your Eclipse workspace (if using Eclipse/ChibiStudio).
Step 4 - Modify the Makefile
There is a path to the board.mk file, change it to point to your board.mk.
Step 5 - Cleanup main() function and write yur code
It is done, you remove the code not needed (blinker thread, test code execution) the you have an empty project.
About documentation and guides: http://www.chibios.org/dokuwiki/doku.ph ... :documents
If you make a more specific question I could guide you through all the documents/guides.
Giovanni
In ChibiOS the support for STM32 is very complete, basically you just need to port the OS to a different board (your target).
I recommend using one of the included demos for a while, you just nead a cheap Discovery or Nucleo board. This will allow you to test everything very quickly, you could download ChibiStudio for a very quick startup.
I am describing the organization for ChibiOS 3.0, it is slightly different for previous versions, you are starting now so 3.0 should be your target. In order to create your project:
Step 1 - Creating new board files
Under ./os/hal/boards there is a directory for each supported board. Copy one of the boards to a new directory, choose a board with the same device you need. You will have for example ./os/hal/boards/myboard.
Step 2 - Modifying board files
Each directory contains always the same files:
myboard/cfg/board.chcfg <- It is an XML file
myboard/board.c
myboard/board.h
myboard/board.mk
The CHCFG file is an XML description of your board: Initial GPIO settings, clock frequency, used device. Using a tool included in ChibiStudio you can generate the .h/.c/.mk files starting from CHCFG file. In ChibiStudio there is a guided XML editor, changing the CHCFG file is driven by a schema so it is not easy to do it wrong. Optionally you can edit board.h manually, it is not difficult but not the preferred way.
Step 3 - Create your application
Clone one of the demos using the same device into another directory: ./demos/myproj. You can use any path but lets start simple.
Open .project and .cproject in an editor and search/replace the project name with your name. Import the new project in your Eclipse workspace (if using Eclipse/ChibiStudio).
Step 4 - Modify the Makefile
There is a path to the board.mk file, change it to point to your board.mk.
Step 5 - Cleanup main() function and write yur code
It is done, you remove the code not needed (blinker thread, test code execution) the you have an empty project.
About documentation and guides: http://www.chibios.org/dokuwiki/doku.ph ... :documents
If you make a more specific question I could guide you through all the documents/guides.
Giovanni
Re: Getting started with ChibiOS ( Newbie question )
Hello Giovanni
Thanks a lot for your description.
I managed to find the XML guide ( opening the XML file in Eclipse provided by ChibiStudio ).
Our processor is a STM32F103RD and the boards ST_NUCLEO_F103RB, OLIMEX_STM32_P103, and OLIMEX_STM32_103STK are properly the closest to ours. But none of them have the /cfg folder or a XML file, just the plane old .h and .c file.
Can I generate an XML file myself or should one be build from scratch?
Regards
Aslund
Thanks a lot for your description.
I managed to find the XML guide ( opening the XML file in Eclipse provided by ChibiStudio ).
Our processor is a STM32F103RD and the boards ST_NUCLEO_F103RB, OLIMEX_STM32_P103, and OLIMEX_STM32_103STK are properly the closest to ours. But none of them have the /cfg folder or a XML file, just the plane old .h and .c file.
Can I generate an XML file myself or should one be build from scratch?
Regards
Aslund
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Getting started with ChibiOS ( Newbie question )
Hi,
The STM32F1xx is the exception because it has an older GPIO with a different registers layout, board.h has to be filled manually but it is very simple.
In general you set as input with pullup all the pins you don't use (or that you want to reprogram at runtime) and the appropriate mode for the other pins, depending on your board wiring.
Giovanni
The STM32F1xx is the exception because it has an older GPIO with a different registers layout, board.h has to be filled manually but it is very simple.
In general you set as input with pullup all the pins you don't use (or that you want to reprogram at runtime) and the appropriate mode for the other pins, depending on your board wiring.
Giovanni
Re: Getting started with ChibiOS ( Newbie question )
Hello Giovanni
I am making progress and I am about to test ChibiOS on our platform, but I have encountered a strange error.
In my board file I have defined my ports:
....
#define GPIOC_PC0 0 // 8
#define GPIOC_PC1 1 // 9
#define GPIOC_PC2 2 // 10
#define GPIOC_PC3 3 // 11
#define GPIOC_PC4 4 // 24
#define GPIOC_PC5 5 // 25
#define GPIOC_PC6 6 // 37
#define GPIOC_PC7 7 // 38
#define GPIOC_PC8 8 // 39
#define GPIOC_PC9 9 // 40
#define GPIOC_PC10 10 // 51
#define GPIOC_PC11 11 // 52
#define GPIOC_PC12 12 // 53
#define GPIOC_PC13_RTC 13 // 2
#define GPIOC_PC14_OSC32IN 14 // 3
#define GPIOC_PC15_OSC32OUT 15 // 4
....
In my code I write:
....
palClearPad(GPIOC, GPIOC_PC8);
palClearPad(GPIOC, GPIOC_PC9);
palClearPad(GPIOC, GPIOC_PC11);
palClearPad(GPIOC, GPIOC_PC12);
palClearPad(GPIOC, GPIOC_PC13_RTC);
palClearPad(GPIOC, GPIOC_PC14_OSC32IN);
palClearPad(GPIOC, GPIOC_PC15_OSC32OUT);
...
But the last 3 lines can not compile as the compiler claims the values are undefined.
I have tried to clean and rebuild. Change names but nothing works.
What is the cause of this very odd behaviour?
Regards
Aslund
I am making progress and I am about to test ChibiOS on our platform, but I have encountered a strange error.
In my board file I have defined my ports:
....
#define GPIOC_PC0 0 // 8
#define GPIOC_PC1 1 // 9
#define GPIOC_PC2 2 // 10
#define GPIOC_PC3 3 // 11
#define GPIOC_PC4 4 // 24
#define GPIOC_PC5 5 // 25
#define GPIOC_PC6 6 // 37
#define GPIOC_PC7 7 // 38
#define GPIOC_PC8 8 // 39
#define GPIOC_PC9 9 // 40
#define GPIOC_PC10 10 // 51
#define GPIOC_PC11 11 // 52
#define GPIOC_PC12 12 // 53
#define GPIOC_PC13_RTC 13 // 2
#define GPIOC_PC14_OSC32IN 14 // 3
#define GPIOC_PC15_OSC32OUT 15 // 4
....
In my code I write:
....
palClearPad(GPIOC, GPIOC_PC8);
palClearPad(GPIOC, GPIOC_PC9);
palClearPad(GPIOC, GPIOC_PC11);
palClearPad(GPIOC, GPIOC_PC12);
palClearPad(GPIOC, GPIOC_PC13_RTC);
palClearPad(GPIOC, GPIOC_PC14_OSC32IN);
palClearPad(GPIOC, GPIOC_PC15_OSC32OUT);
...
But the last 3 lines can not compile as the compiler claims the values are undefined.
I have tried to clean and rebuild. Change names but nothing works.
What is the cause of this very odd behaviour?
Regards
Aslund
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Getting started with ChibiOS ( Newbie question )
Is the link in the Makefile to your board file correct?
Giovanni
Giovanni
Re: Getting started with ChibiOS ( Newbie question )
Hey Giovanni
Missed that one. Thanks a lot.
Looked in the project makefile and everything was right there. Did not pay attention to the boardmake file.
Missed that one. Thanks a lot.
Looked in the project makefile and everything was right there. Did not pay attention to the boardmake file.
Who is online
Users browsing this forum: No registered users and 16 guests