Hi,
I'm working on IAR. I'm using FreeRTOS v9.0.0 on a STM32F417 microcontroller.
I encounter problems when I declare and use float variables and double variables.
The following code causes an Hardfault Handler.
~~~
void vTestTask(void *pvParameters)
{
for(;;)
{
float test;
test = (float)(0x22);
vTaskDelay(2000U);
}
}
~~~
Some details:
* I use heap 4.
* MCU frequency 16MHz
* Operating system used the systick
* FPU is activated.
* The heap is located in the RTOS_RESERVED region, which is located in the CCRAM (see the linker file above).
* The hardfault doesn't occur when I write this code outside the task.
* The hardfault occurs when vTaskDelay function ends, so it seems it's when the context task is restored.
Could you give me some hint please ?
Please find abovemy FreeRTOSConfig.h file and the linker file.
Regards,
Ophélie
Linker file:
/###ICF### Section handled by ICF editor, don't touch! ****/
/-Editor annotation file-/
/ IcfEditorFile="$TOOLKITDIR$configideIcfEditorcortexv10.xml" /
/-Specials-*/
define symbol __ICFEDITintvecstart__ = 0x08000000;
/-Memory Regions-/
define symbol __ICFEDITregionROMstart__ = 0x08000000;
define symbol ICFEDITregionROM_end = 0x080DFFFF;
define symbol ICFEDITregionRAM_start = 0x20000000;
define symbol ICFEDITregionRAM_end = 0x2001FAFF;
define symbol ICFEDITregionCCMRAM_start = 0x10000000;
define symbol ICFEDITregionCCMRAM_end = 0x1000FFFF;
/-Sizes-/
define symbol ICFEDITsizecstack = 0x500;
define symbol ICFEDITsizeheap = 0x00;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROMregion = mem:[from __ICFEDITregionROMstart__ to ICFEDITregionROM_end];
define region RAMregion = mem:[from __ICFEDITregionRAMstart__ to ICFEDITregionRAM_end];
define region CCMRAMregion = mem:[from __ICFEDITregionCCMRAMstart__ to ICFEDITregionCCMRAM_end];
define block CSTACK with alignment = 8, size = ICFEDITsizecstack { };
define block HEAP with alignment = 8, size = ICFEDITsizeheap { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:ICFEDITintvecstart { readonly section .intvec };
place in ROMregion { readonly };
place in CCMRAMregion { readwrite data section RTOSRESERVEDRAM };
place in RAM_region { readwrite, block CSTACK, block HEAP};
FreeRTOSCongig.h:
~~~
ifdef ICCARM
include "system_stm32f4xx.h"
extern void assertfailed(uint8t* file, uint32_t line); /* Function prototype defined in errorUtils.h */
endif
define configUSE_PREEMPTION 1
define configUSEPORTOPTIMISEDTASKSELECTION 1
define configUSETICKLESSIDLE 1
define configEXPECTEDIDLETIMEBEFORESLEEP 5
define configCPUCLOCKHZ SystemCoreClock
define configTICKRATEHZ 100
ifdef NDEBUG
/* TODO : remove NDEBUG once we have real board : if we remove it we lost debug, but with right SWD connection it should work */
define configSYSTICKCLOCKHZ SystemCoreClock/8
endif
define configMAX_PRIORITIES 10
define configMINIMALSTACKSIZE 128
define configMAXTASKNAME_LEN 16
define configUSE16BIT_TICKS 0
define configIDLESHOULDYIELD 1
define configUSETASKNOTIFICATIONS 1
define configUSE_MUTEXES 1
define configUSERECURSIVEMUTEXES 0
define configUSECOUNTINGSEMAPHORES 1
define configUSEALTERNATIVEAPI 0 /* Deprecated! */
define configQUEUEREGISTRYSIZE 40
define configUSEQUEUESETS 1
define configUSETIMESLICING 0
define configUSENEWLIBREENTRANT 0
define configENABLEBACKWARDCOMPATIBILITY 1
define configNUMTHREADLOCALSTORAGEPOINTERS 5
define configUSEAPPLICATIONTASK_TAG 0
/* Memory allocation related definitions. */
define configSUPPORTSTATICALLOCATION 0
define configSUPPORTDYNAMICALLOCATION 1
define configTOTALHEAPSIZE (17 * 1024)
define configAPPLICATIONALLOCATEDHEAP 1
/* Hook function related definitions. */
define configUSEIDLEHOOK 0
define configUSETICKHOOK 0
ifndef NDEBUG
define configCHECKFORSTACK_OVERFLOW 2
else
define configCHECKFORSTACK_OVERFLOW 0
endif
define configUSEMALLOCFAILED_HOOK 0
define configUSEDAEMONTASKSTARTUPHOOK 0
/* Run time and task stats gathering related definitions. */
define configGENERATERUNTIME_STATS 0
define configUSETRACEFACILITY 0
define configUSESTATSFORMATTING_FUNCTIONS 0
/* Co-routine related definitions. */
define configUSECOROUTINES 0
define configMAXCOROUTINE_PRIORITIES 2
/* Software timer related definitions. */
define configUSE_TIMERS 1
define configTIMERTASKPRIORITY 5
define configTIMERQUEUELENGTH 5
define configTIMERTASKSTACKDEPTH configMINIMALSTACK_SIZE
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
define configLIBRARYLOWESTINTERRUPT_PRIORITY 15
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
define configLIBRARYMAXSYSCALLINTERRUPTPRIORITY 5
/* Interrupt nesting behaviour configuration. /
/ Cortex-M specific definitions. */
ifdef _NVICPRIO_BITS
/* _NVICPRIO_BITS will be specified when CMSIS is being used. */
define configPRIOBITS __NVICPRIO_BITS
else
define configPRIOBITS 4 /* 15 priority levels - __NVICPRIO_BITS value is 4 */
endif
define configKERNELINTERRUPTPRIORITY ( configLIBRARYLOWESTINTERRUPTPRIORITY << (8 - configPRIOBITS) )
define configMAXSYSCALLINTERRUPTPRIORITY ( configLIBRARYMAXSYSCALLINTERRUPTPRIORITY << (8 - configPRIOBITS) )
/* Define to trap errors during development. */
define configASSERT( x ) if( ( x ) == 0 ) { assert_failed(FILE, LINE); }
/* Optional functions - most linkers will remove unused functions anyway. */
define INCLUDE_vTaskPrioritySet 1
define INCLUDE_uxTaskPriorityGet 1
define INCLUDE_vTaskDelete 1
define INCLUDE_vTaskSuspend 1
define INCLUDE_xResumeFromISR 1
define INCLUDE_vTaskDelayUntil 1
define INCLUDE_vTaskDelay 1
define INCLUDE_xTaskGetSchedulerState 1
define INCLUDE_xTaskGetCurrentTaskHandle 1
define INCLUDE_uxTaskGetStackHighWaterMark 0
define INCLUDE_xTaskGetIdleTaskHandle 0
define INCLUDE_eTaskGetState 0
define INCLUDE_xEventGroupSetBitFromISR 1
define INCLUDE_xTimerPendFunctionCall 0
define INCLUDE_xTaskAbortDelay 0
define INCLUDE_xTaskGetHandle 0
define INCLUDE_xTaskResumeFromISR 1
~~~