Nick, I compiled your Makefile project successfully, but I must admit that I have never worked with SEGGER yet.
I tried to debug the project using openocd.exe but it doesn’t get far, it doesn’t even reach the reset handler:
~~~
Reset
Handler:
ldr sp, =estack /* set stack pointer */
~~~
What I miss in your Makefile is creating a total listing ( LSS ), which you can make as follows:
~~~
OBJDUMP = arm-none-eabi-objdump
$(BUILD
DIR)/%.lss: $(BUILDDIR)/%.elf | $(BUILD_DIR)
$(OBJDUMP) -S $< > $@
~~~
The LSS file is useful to understand a HardFault: you can lookup any address. But it won’t help avoiding the crash.
…
It turns out that the linker flags weren’t correct for me: a non-thumb ( =ARM ) version of
__libc_init_array
was linked used, causing a crash.
See e.g.
here
Also I needed a different .LD file for my board:
~~~
#LDSCRIPT = STM32F769NIHx
FLASH.ld # yours
LDSCRIPT = STM32F746NGHxFLASH.ld # mine
~~~
Also I have to use a different version of port.c :
~~~
#portable/GCC/ARM
CM4F/port.c # yours
portable/GCC/ARMCM7/r0p1/port.c # mine
~~~
I always advice to start testing a TCP application without DHCP:
~~~
#define ipconfigUSE_DHCP 0
~~~
So at least you know which device to ping.
Would you mind to remove ( or rename ) two files from the HAL driver directories?
~~~
Drivers/STM32F7xx
HALDriver/src/stm32f7xx
haleth.c
Drivers/STM32F7xx
HALDriver/inc/stm32f7xx
haleth.h
~~~
Otherwise there will be confusion.
I always use the following utility files:
~~~
../../FreeRTOS-Plus/Demo/Common/Utilities/printf-stdarg.c
Src/memcpy.c
~~~
You will find them in the /labs release
I never really liked these ( HAL ) functions:
~~~
void SysTick
Handler(void)
{
HALIncTick();
if(xTaskGetSchedulerState() != taskSCHEDULER
NOTSTARTED)
{
xPortSysTickHandler();
}
}
__weak void HAL_IncTick(void)
{
uwTick++;
}
/* And also */
void vApplicationTickHook( void )
{
/* Call the ST HAL tick function. */
HAL_IncTick();
}
/* And also */
void HAL
TIMPeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance == TIM13) {
HAL_IncTick();
}
}
~~~
In my opinion,
SysTick_Handler()
is part of the OS and should not be overridden.
The function
HAL_IncTick()
will only increment a counter. Why not use the FreeRTOS tick-count?
Or some other timer, like e.eg this:
~~~
#include “hr
gettime.h”
uint32t HAL
GetTick(void)
{
uint64t ullResult = ullGetHighResolutionTime();
/* convert uS to ms. */
return ( uint32_t ) ( ullResult / 1000ull );
}
~~~
What I can see is that my STM32F7 does not crash any more, and I can ping the device.
But I still haven’t tested everything.
Hope this helps for now,
Hein