2022-07-18 09:42 AM
When the SysTick interrupt fires the debugger quits.
I cannot figure out where the NVIC_SetVector statement is for the SysTick. I think it is not set. But I can not find the vector table in the debugger to know for sure.
This used to work, But when I updated to the 1.10.1 IDE and 6.6.1-RC2 Build.20220706-1420. It crashes when the systick interrupt happens.
I am using the STM32G051K8T
Solved! Go to Solution.
2022-07-19 03:48 PM
That CubeProgrammer description of nBOOT0 and nBOOT1 options is a nonsense. Again a blind trust without checking the real thing - reference manual...
Look at the RM0444 Rev 5, 2.5 Boot configuration, Table 8. Boot modes.
@Houda GHABRI
2022-07-18 10:37 AM
SysTick is part of the ARM core and its interrupt is enabled in SysTick_Config, see SYST_CSR register. The handler is implicitly set already in the g_pfnVectors table, see startup code and implemented in stm32g0xx_it.c. Works here on a Nucleo G071 board without issues with your tool versions.
hth
KnarfB
2022-07-18 10:53 AM
I tried to look at it in the debugger. it says g_pfnVectors <data variable, no debug info>
2022-07-18 11:04 AM
You can see the source code in the startup file, startup_stm32g071rbtx.s in my case. The startup file also has a default "do nothing" implementation of SysTick_Handler in the startup file. This "weak" declaration is overridden by SysTick_Handler in stm32g0xx_it.c.
You may check that g_pfnVectors table holds the correct handler address at the SysTick offset by inspecting memory in the debugger.
Don't think that a missing SysTick_Handler is issue.
> the debugger quits
Any output, logs? What if you step at assembly level? A fault?
hth
KnarfB
2022-07-18 11:06 AM
I found it in the startup_stm32g051k8tx.s and the vector table looks good.
But when I put a breakpoint in the SysTick_Handler program, the debugger crashes before I get to the interrupt there. It appears the interrupt is going somewhere weird, and crashing. I believe that is the only interrupt active and it is initialized by HAL_Init() and the system crashes shortly after HAL_Init() is executed and I am looping on __NOP(); commands. That is all that is running.
Something is wrong.
2022-07-18 11:11 AM
Here is my code:
int main(void)
{
/* USER CODE BEGIN 1 */
/*
{
uint16_t i, j;
for (i=0;i<525;i++)
{
for (j=0;j<60000;j++) __NOP();
}
}
*/
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
//SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
// MX_GPIO_Init();
// MX_DMA_Init();
// MX_ADC1_Init();
// MX_I2C1_Init();
// MX_TIM2_Init();
// MX_TIM3_Init();
// MX_TIM14_Init();
// MX_USART1_UART_Init();
// MX_USART2_UART_Init();
/* Initialize interrupts */
// MX_NVIC_Init();
/* USER CODE BEGIN 2 */
//__disable_irq();
/*
ENCODER_POWER_OFF; // Make sure encoder is off so it can start correctly.
print_debug_str("Encoder Power Off\r\n");
TASK_PIN_L;
TP2_L;
DIO2_L;
DIO3_L;
DIO4_L;
if (isDebug(DEBUG_verify_memory_structures))
{
verify_memory_structures();
}
*/
__NOP();
{
uint16_t i;
for (i=0;i<1000;i++)
{
__NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 20
__NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 40
__NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 60
__NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 80
__NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); __NOP(); // 100
}
}
//ADC_init();
__NOP();
I also put a breakpoint in SysTic_Handler() found in stm32g0xx_it.c but the debugger crashes before I get there.
/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
/* USER CODE END SysTick_IRQn 1 */
}
2022-07-18 11:50 AM
Open the memory view at 0x0800003C and check whether it contains the SysTick_Handler() address.
2022-07-18 12:21 PM
Where should I look for output logs?
It is taking a long time to step until the interrupt fires. I am still working on it. Somewhere around 155 loop iterations. No message, The debugger just stops responding I single step. .
2022-07-18 12:44 PM
From the .map file.
.text.SysTick_Handler
0x0000000008005778 0x8 ./Core/Src/stm32g0xx_it.o
0x0000000008005778 SysTick_Handler
Why is it off by 1? 0x08005779? Should be a number divisible by 4 I would think.
It looks like all the vectors are odd numbers.
The Startup file has:
.section .isr_vector,"a",%progbits
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word 0
.word 0
.word PendSV_Handler
.word SysTick_Handler
.word WWDG_IRQHandler /* Window WatchDog */
.word PVD_IRQHandler /* PVD through EXTI Line detect */
.word RTC_TAMP_IRQHandler /* RTC through the EXTI line */
.word FLASH_IRQHandler /* FLASH */
.word RCC_IRQHandler /* RCC */
.word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */
.word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */
.word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */
.word 0 /* reserved */
.word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
.word DMA1_Channel2_3_IRQHandler /* DMA1 Channel 2 and Channel 3 */
.word DMA1_Ch4_7_DMAMUX1_OVR_IRQHandler /* DMA1 Channel 4 to Channel 7, DMAMUX1 overrun */
.word ADC1_COMP_IRQHandler /* ADC1, COMP1 and COMP2 */
.word TIM1_BRK_UP_TRG_COM_IRQHandler /* TIM1 Break, Update, Trigger and Commutation */
.word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
.word TIM2_IRQHandler /* TIM2 */
.word TIM3_IRQHandler /* TIM3 */
.word TIM6_DAC_LPTIM1_IRQHandler /* TIM6, DAC & LPTIM1 */
.word TIM7_LPTIM2_IRQHandler /* TIM7 & LPTIM2 */
.word TIM14_IRQHandler /* TIM14 */
.word TIM15_IRQHandler /* TIM15 */
.word TIM16_IRQHandler /* TIM16 */
.word TIM17_IRQHandler /* TIM17 */
.word I2C1_IRQHandler /* I2C1 */
.word I2C2_IRQHandler /* I2C2 */
.word SPI1_IRQHandler /* SPI1 */
.word SPI2_IRQHandler /* SPI2 */
.word USART1_IRQHandler /* USART1 */
.word USART2_IRQHandler /* USART2 */
.word LPUART1_IRQHandler /* LPUART1 */
Which looks right.
2022-07-18 12:48 PM
> Why is it off by 1? 0x08005779? Should be a number divisible by 4 I would think.
LSB 1 indicates thumb mode, looks correct.