include <stdio.h>**
include <stdint.h>
include <intrinsics.h>
include “stm32f7xx.h” // STM32F746VG Cortex-M7 Device
include <core_cm7.h> // STM32F746VG Cortex-M7 Core
typedef void (application_t) (void); extern const uint32t appvector; // Application vector address symbol from // the linker configuration file: 0x08080000 typedef struct vector { uint32t stackaddr; // intvec[0] is initial Stack Pointer applicationt *funcp; // intvec[1] is initial Program Counter } vector_t; int main(void) { const vectort *vectorp = (vectort*) &appvector; volatile uint32t stackarr[100] = {0}; // Allocate some stack just to show that // the SP should be reset before the jump – or the // stack won’t be configured correctly. __enableinterrupt(); printf(“Hello from bootloader!n”); __disableinterrupt(); // 1. Disable interrupts __setSP(vectorp->stackaddr); // 2. Configure stack pointer SCB->VTOR = (uint32t) &appvector; // 3. Configure VTOR vectorp->func_p(); // 4. Jump to application } //—— And this is my application’ main() function; it is using STM HALL library ant FreeRTOS libtrary (it is a multitasking application) //—— int main(void) { printf(“Hello from application!n”);/* Enable the CPU Cache */
CPU_CACHE_Enable();
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Several modules initialization */
/* ...... */
/* Call init function for freertos objects (in freertos.c) */
MX_FREERTOS_Init();
/* Start scheduler */
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
while ( 1 );
}
//——
The jump to application is successfull, and everything executes ok until “MXFREERTOSInit();”
I was able to trace the issue to:
MXFREERTOSInit() ->
myMutex01Handle = osMutexCreate(osMutex(myMutex01)); ->
return xSemaphoreCreateMutex(); = xQueueCreateMutex( queueQUEUETYPEMUTEX ); ->
xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType ); ->
pvPortMalloc( sizeof( Queuet ) + xQueueSizeInBytes ); ->
( void ) xTaskResumeAll(); ->
taskENTERCRITICAL() = portENTERCRITICAL() = vPortEnterCritical() ->
portDISABLEINTERRUPTS(); // stalls here!
I broke the last macro into containing functions:
__disableinterrupt();__setBASEPRI( configMAXSYSCALLINTERRUPTPRIORITY );
__DSB();
__ISB();
__enableinterrupt(); The code run stalls in the last instruction: __enable_interrupt(); Any idea what can be frong? Note: If the application is loaded at address 0x08000000 (no bootloader), it runs OK. -Thanks!