Im trying to start the firmware located at address 0x08019000 inside my Flash, but even after making a successfully jump to the address, the firmware doesnt respond.
Im using the HSDatalog firmware from ST, which can be downloaded from github here. As microcontroller i use the STEVAL-STWINKT1B evaluation board with 2MB FLASH and 640KB RAM. My bootloader is successfully jumping to each flashed firmware that i use in my project, hence the it's code is not an issue. However, the firmware from ST seems "stuck" after i get to a task scheduler loop inside it and i can't understand why. Its main looks like this
int main(void) {
HAL_Init();
SystemClock_Config();
/* Enable Power Clock*/
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnableVddUSB();
HAL_PWREx_EnableVddIO2();
BSP_Enable_DCDC2();
OTA_Verify_Current_Active_Bank();
/* Configure the Battery Charger */
// BattChrg_Init(); not needed
/* Configure Power Voltage Detector(PVD) to detect if battery voltage is low */
// PVD_Config(); not needed
/* Configure DEBUG PIN and LED */
BSP_DEBUG_PIN_Init_All();
BSP_LED_Init(LED_GREEN);
BSP_LED_Init(LED_ORANGE);
__HAL_RCC_GPIOA_CLK_ENABLE();
/* Initialize srand() using STM32 TRNG peripheral */
RND_Init();
HSD_JSON_set_allocation_functions(HSD_malloc, HSD_free);
/* Start USB */
MX_USB_DEVICE_Init();
HAL_Delay(100);
HSD_DeviceDescriptor_Init_t deviceDescriptorInit;
/* Set default device description */
strcpy(deviceDescriptorInit.alias, "STWIN_001");
strcpy(deviceDescriptorInit.model, "STEVAL-STWINKT1B");
strcpy(deviceDescriptorInit.partNumber, "FP-SNS-DATALOG1");
strcpy(deviceDescriptorInit.URL, "www.st.com/stwin");
strcpy(deviceDescriptorInit.fwName, "FP-SNS-DATALOG1_Datalog1");
strcpy(deviceDescriptorInit.bleMacAddress, "00:00:00:00:00:00");
char tmp1[6] = {
HSD_VERSION_MAJOR, '.',
HSD_VERSION_MINOR, '.',
HSD_VERSION_PATCH, '\0' };
strcpy(deviceDescriptorInit.fwVersion, tmp1);
set_device_description(&deviceDescriptorInit);
/* Populate the sensor database and enable all sensors */
Create_Sensors();
/* Initialize tags */
HSD_TAGS_init(COM_GetDevice());
/* USER Button initialization */
BSP_PB_Init(BUTTON_USER, BUTTON_MODE_EXTI);
BSP_PB_PWR_Init();
/* Sensor Manager initialization */
SM_Peripheral_Init();
SM_OS_Init();
Peripheral_MSP_Init_All();
/* SD card Manager initialization */
SDM_Peripheral_Init();
/* Initialize sensors and SD card threads */
Peripheral_OS_Init_All();
SDM_OS_Init();
/* Initialize and allocate AutoMode thread */
g_pxAMtaskObj = AMTaskAlloc();
AMTaskInit(g_pxAMtaskObj);
/* initialize and allocate BLE thread */
#if (HSD_BLE_ENABLE == 1)
BLE_CM_OS_Init();
#endif
/* Start scheduler */
**osKernelStart**();
while (1)
;
}
- Bootloader program here(Credit to Akos Pasztor)
- Bootloader usage in main.c here
Im invoking the Enter_Bootloader function after i successfully mounted an FatFS formated SD card. That function flashed my .bin onto the FLASH beginning at a specified address. Afterwards im jumping to the application using the Bootloader_JumpToApplication function.
Has anyone ideas why the firmware may get stuck? And has anyone used this firmware together with a bootloader to share his experience?