manua wrote on Monday, September 23, 2019:
On Mon, Sep 23, 2019 at 8:04 AM Richard Barry
rtel@users.sourceforge.net wrote:
If I am reading your code correctly then you are attempting to use a
scheduler API function without first starting the scheduler running. I
would highly recommend starting with some of the pre-configured examples
and reading through the free book download available on
Free RTOS Book and Reference Manual
Ahh… Without a task, I’ve been delaying the task!
Changed my code, but 2 issues still remain for me to move ahead.
/**
- Blinky example
- Blinks LED @1Hz on PB.6
*/
#include <stm32f30x.h>
#include <stm32f30x_rcc.h>
#include <stm32f30x_conf.h>
#include <FreeRTOS.h>
#include “task.h”
void HardFault_Handler(unsigned int *hardfault_args, unsigned int r4,
unsigned int r5, unsigned int r6)
{
while (1);
}
void task_led(void *params)
{
while(1) {
GPIOB->ODR ^= GPIO_Pin_6;
vTaskDelay(500 / portTICK_RATE_MS);
}
}
int main(void)
{
GPIO_InitTypeDef gpio_state;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); /*
Enable the GPIO_LED Clock */
/* Configure the GPIO_LED pin */
gpio_state.GPIO_Pin = GPIO_Pin_6; /* Pin 6 */
gpio_state.GPIO_Mode = GPIO_Mode_OUT;
gpio_state.GPIO_OType = GPIO_OType_PP; /* Push Pull
Output /
gpio_state.GPIO_PuPd = GPIO_PuPd_NOPULL; / No
Pullup */
gpio_state.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &gpio_state); /* Port B */
xTaskCreate(task_led, "LED", 512, NULL, 1, NULL);
vTaskStartScheduler();
}
Changing the code, I had to modify the Heap size in addition to the
previous changes suggested by Gaurav;
in FreeRTOSConfig.h changed :
//#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 75 * 1024 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) (9 * 1024 ) )
/* F334 has 12k + 4k SRAM */
With that change, the build goes ahead.
#1. The MDK5 complains about FreeRTOS.h not found.
(It looks odd, but the build goes ahead without errors or warnings.
I would nevertheless like to fix this issue, though. Does not look nice.)
Attached screenshot. The same issues exists with port.c as well,
wherever FreeRTOS.h
header is included.
Is it possible to fix this issue ? (It’s cosmetic though, but feels
like an irritant)
#2. With the change to TOTAL HEAP SIZE I can see task_led being executed.
The TOTAL_HEAP_SIZE value that appears to work is between (5 * 1024)
and (9 * 1024)
Anything smaller than 5k does not work and anything greater than 9k
does not work.
a) Does that mean that FreeRTOS Kernel is consuming 5k ?
b) the F334 has about 12k SRAM, I should be able to use it as well ?
Thanks,