Commit 047b701a authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana Committed by Matthieu Cattin

sw: FreeRTOS blinky up and running

Signed-off-by: Theodor-Adrian Stana's avatarTheodor Stana <t.stana@cern.ch>
parent 4ac68759
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
DEVICE = EFM32GG330F1024 DEVICE = EFM32GG330F1024
PROJECTNAME = freertos_blink PROJECTNAME = freertos_blink
# Name of interface configuration file used by OpenOCD
OOCD_IFACE ?= stlink-v2-1
OBJ_DIR = build OBJ_DIR = build
EXE_DIR = exe EXE_DIR = exe
...@@ -210,7 +212,7 @@ ifeq ($(filter $(MAKECMDGOALS),all debug release),) ...@@ -210,7 +212,7 @@ ifeq ($(filter $(MAKECMDGOALS),all debug release),)
endif endif
flash: $(EXE_DIR)/$(PROJECTNAME).bin flash: $(EXE_DIR)/$(PROJECTNAME).bin
openocd -s ./openocd -f interface/$(OOCD_IFACE).cfg -f init.cfg -c "program $(EXE_DIR)/$(PROJECTNAME).bin 0 verify reset" openocd -s ../openocd -f interface/$(OOCD_IFACE).cfg -f init.cfg -c "program $(EXE_DIR)/$(PROJECTNAME).bin 0 verify reset"
# include auto-generated dependency files (explicit rules) # include auto-generated dependency files (explicit rules)
ifneq (clean,$(findstring clean, $(MAKECMDGOALS))) ifneq (clean,$(findstring clean, $(MAKECMDGOALS)))
......
#
# efm32 stlink pseudo target
#
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME efm32
}
# Work-area is a space in RAM used for flash programming
# By default use 2kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x800
}
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
set _CPUTAPID 0x2ba01477
}
# EFM32 MCUs only support SWD interface
set _TRANSPORT hla_swd
transport select $_TRANSPORT
hla newtap $_CHIPNAME cpu -expected-id $_CPUTAPID
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME hla_target -chain-position $_TARGETNAME
$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME efm32 0 0 0 0 $_TARGETNAME
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
# cortex_m reset_config sysresetreq
source [find efm32_stlink2.cfg]
init
flash probe 0
...@@ -83,14 +83,12 @@ static void LedBlink(void *pParameters) ...@@ -83,14 +83,12 @@ static void LedBlink(void *pParameters)
*****************************************************************************/ *****************************************************************************/
int main(void) int main(void)
{ {
int i; int i;
/* Chip errata */ /* Chip errata */
CHIP_Init(); CHIP_Init();
/* Setup SysTick Timer for 1 msec interrupts */ /* Enable clocks */
if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000)) while (1);
CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_HFPER, true);
CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_GPIO, true);
...@@ -106,12 +104,16 @@ int main(void) ...@@ -106,12 +104,16 @@ int main(void)
#endif #endif
/* Parameters value for taks*/ /* Parameters value for taks*/
static TaskParams_t parametersToTask1 = { 1000 / portTICK_RATE_MS, 1 }; static TaskParams_t parametersToTask1 = { 500 / portTICK_RATE_MS, 1 };
static TaskParams_t parametersToTask2 = { 500 / portTICK_RATE_MS, 2 }; static TaskParams_t parametersToTask2 = { 250 / portTICK_RATE_MS, 2 };
static TaskParams_t parametersToTask3 = { 125 / portTICK_RATE_MS, 3 };
static TaskParams_t parametersToTask4 = { 62 / portTICK_RATE_MS, 4 };
/*Create two task for blinking leds*/ /*Create two task for blinking leds*/
xTaskCreate( LedBlink, (const signed char *) "LedBlink1", STACK_SIZE_FOR_TASK, &parametersToTask1, TASK_PRIORITY, NULL); xTaskCreate( LedBlink, (const signed char *) "LedBlink1", STACK_SIZE_FOR_TASK, &parametersToTask1, TASK_PRIORITY, NULL);
xTaskCreate( LedBlink, (const signed char *) "LedBlink2", STACK_SIZE_FOR_TASK, &parametersToTask2, TASK_PRIORITY, NULL); xTaskCreate( LedBlink, (const signed char *) "LedBlink2", STACK_SIZE_FOR_TASK, &parametersToTask2, TASK_PRIORITY, NULL);
xTaskCreate( LedBlink, (const signed char *) "LedBlink3", STACK_SIZE_FOR_TASK, &parametersToTask3, TASK_PRIORITY, NULL);
xTaskCreate( LedBlink, (const signed char *) "LedBlink4", STACK_SIZE_FOR_TASK, &parametersToTask4, TASK_PRIORITY, NULL);
/*Start FreeRTOS Scheduler*/ /*Start FreeRTOS Scheduler*/
vTaskStartScheduler(); vTaskStartScheduler();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment