Getting started with STM32F4Discovery and ChibiOS

ChibiOS is a portable,open source RTOS…ChibiOS can be downloaded from source forge

http://sourceforge.net/projects/chibios/

Extract the downloaded file..Inside the folder you can see a folder named Demos inside that our board will be listed ARMCM4-STM32F407-DISCOVERY inside that folder there will be a main.c….Edit that main.c file

#include "ch.h"
#include "hal.h"

int main(void) {

halInit();
chSysInit();

palSetPadMode(GPIOD, GPIOD_LED4, PAL_MODE_OUTPUT_PUSHPULL); /* Green. */

while (TRUE) {
palSetPad(GPIOD, GPIOD_LED4);
chThdSleepMilliseconds(500);
palClearPad(GPIOD, GPIOD_LED4);
chThdSleepMilliseconds(500);
}
}

palSetPadMode configure the I/O as input or output….palSetPad and  palClearPad is similar to High and Low…halinit is the intialization of hardware abstraction layer and chsysinit is the intialization of kernel…

Open a terminal and change directory to that folder

cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/

make

st-flash write build/ch.bin 0x08000000

Happy Hacking 🙂

Advertisements

2 thoughts on “Getting started with STM32F4Discovery and ChibiOS

  1. amazing. the first time for me something like this just worked out of the box.
    I had a hard time with freeRTOS just to realize that there’s no HAL so I want to try ChibiOS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s