Skip to main content
Associate II
July 30, 2025
Solved

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

  • July 30, 2025
  • 3 replies
  • 517 views

 

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,

Best answer by Karl Yamashita

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

 

3 replies

Karl Yamashita
Karl YamashitaBest answer
Principal
July 31, 2025

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 a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
oalselwiAuthor
Associate II
July 31, 2025

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 :)

oalselwiAuthor
Associate II
August 2, 2025

Hello @Karl Yamashita,

I tried it on windows and it works. i think it is a problem with macOS.

Thanks :)