cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE or STM32CubeMX doesnot generate SPI HAL code for Nucleo-H7S3L8

oalselwi
Associate II

 

Hey there,

I’m trying to enable SPI on the NUCLEO-H7S3L8 using the Template_XIP project from STM32CubeH7RS, but I’m running into issues.

First, I tried enabling SPI1 through CubeMX on the Template_XIP project, but it didn’t generate the necessary driver code. When I build, I get this error:
/Users/++++++/STM32Cube/Repository/STM32Cube_FW_H7RS_V1.2.0/Projects/NUCLEO-H7S3L8/Templates/Template_XIP/Appli/Src/main.c:167:(.text.MX_SPI1_Init+0x96): undefined reference to `HAL_SPI_Init'
collect2: error: ld returned 1 exit status
make: *** [makefile:66: Template_XIP_Appli.elf] Error 1

 

So I made a new project from scratch for the same board, copied the relevant config from Template_XIP, and now CubeMX does generate the SPI code. But when I run it, I get a HardFault right away.

I tried digging into it with the usual debug steps according to this blog "How to debug a HardFault on an Arm® Cortex®-M STM32" (SP was 0x2000FFDC, next addresses 0x20020000, 0x20010024…), but honestly none of it makes sense and I can’t trace what’s causing it.

I posted about a similar issue on my blog a while ago and got no response.

Maybe someone from ST can take a look? Or anyone else who ran into something like this with Template_XIP?

Thanks,

2 REPLIES 2
Karl Yamashita
Principal

Try importing the Template_XIP project into STM32CubeIDE first. Then open the IOC file to add the SPI peripheral, and generate code. It should add the HAL SPI drivers. That's how it is working for me.

 

KarlYamashita_0-1753922613184.png

 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.
oalselwi
Associate II

Hello @Karl Yamashita,

This is exactly what I tried, but for some reason, it doesn’t work—neither on my Mac nor on Windows. I’ve tried reinstalling STM32CubeIDE with no success. I also ran the IDE as administrator on both macOS and Windows, but that didn’t help either. Lastly, I gave it a try using STM32CubeMX, but still no luck.

Here’s a screenshot of my setup: I imported the Template_XIP project from the following path:
STM32Cube/Repository/STM32Cube_FW_H7RS_V1.2.0/Projects/NUCLEO-H7S3L8/Templates/Template_XIP

oalselwi_0-1753952822313.png

thanks :)