To use the gpio pins…
cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/
Similar to the earlier method edit the main.c file and insert this code
#include "ch.h" #include "hal.h" int main(void) { halInit(); chSysInit(); palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); /* PD4 */ while (TRUE) { palSetPad(GPIOD, 4); chThdSleepMilliseconds(500); palClearPad(GPIOD, 4); chThdSleepMilliseconds(500); } }
The palSetPadMode configures PD4 or GPIOD’s fourth pin as output..now connect an led to the PD4 and see output
Now repeat the older steps to generate binary
cd ChibiOS_2.4.1/demos/ARMCM4-STM32F407-DISCOVERY/ make st-flash write build/ch.bin 0x08000000
Happy Hacking 🙂