Skip to content

Error when building PY32F002Bx5: py32f0xx_hal.h: No such file or directory #57

@WesleyAC

Description

@WesleyAC

I cloned this repo, changed MCU_TYPE to PY32F002Bx5, changed ARM_TOOLCHAIN to the correct location (a path in /nix/store, since I'm on NixOS), and ran V=1 make, which gave the following error:

[nix-shell] ~/code/py32f0-template$ V=1 make
  CC	User/py32f0xx_it.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -MT Build/User/py32f0xx_it.o -o Build/User/py32f0xx_it.o -c User/py32f0xx_it.c -MD -MF ./Build/User/py32f0xx_it.d -MP
User/py32f0xx_it.c:24:10: fatal error: py32f0xx_hal.h: No such file or directory
   24 | #include "py32f0xx_hal.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [rules.mk:99: Build/User/py32f0xx_it.o] Error 1

I'm not quite sure what should be happening here. That file does exist as Libraries/PY32F0xx_HAL_Driver/Inc/py32f0xx_hal.h, but it's not included in the INCLUDES in the Makefile in the PY32F002Bx5 case, instead including Libraries/PY32F002B_HAL_Driver/Inc, which has the more specific py32f002b_hal.h. I've tried both directions of fixing that: changing py32f0xx_it.c to include the py32f002b_hal.h and changing the INCLUDES to include the py32f0xx_hal.h, both seem to result in this similar error:

[nix-shell] ~/code/py32f0-template$ V=1 make
  CC	User/py32f0xx_it.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -MT Build/User/py32f0xx_it.o -o Build/User/py32f0xx_it.o -c User/py32f0xx_it.c -MD -MF ./Build/User/py32f0xx_it.d -MP
In file included from User/py32f0xx_it.c:24:
./Libraries/PY32F002B_HAL_Driver/Inc/py32f002b_hal.h:33:10: fatal error: py32f002b_hal_conf.h: No such file or directory
   33 | #include "py32f002b_hal_conf.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [rules.mk:99: Build/User/py32f0xx_it.o] Error 1
[nix-shell] ~/code/py32f0-template$ V=1 make
  CC	User/py32f0xx_it.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -I ./Libraries/PY32F0xx_HAL_Driver/Inc -I ./Libraries/PY32F0xx_HAL_BSP/Inc -MT Build/User/py32f0xx_it.o -o Build/User/py32f0xx_it.o -c User/py32f0xx_it.c -MD -MF ./Build/User/py32f0xx_it.d -MP
  CC	User/py32f0xx_hal_msp.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -I ./Libraries/PY32F0xx_HAL_Driver/Inc -I ./Libraries/PY32F0xx_HAL_BSP/Inc -MT Build/User/py32f0xx_hal_msp.o -o Build/User/py32f0xx_hal_msp.o -c User/py32f0xx_hal_msp.c -MD -MF ./Build/User/py32f0xx_hal_msp.d -MP
  CC	User/main.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -I ./Libraries/PY32F0xx_HAL_Driver/Inc -I ./Libraries/PY32F0xx_HAL_BSP/Inc -MT Build/User/main.o -o Build/User/main.o -c User/main.c -MD -MF ./Build/User/main.d -MP
  CC	Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.c
/nix/store/ra5wly4vbakq66srldxm57lg8qnmb4jr-gcc-arm-embedded-12.3.rel1/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -gdwarf-3 -Os -std=c17 -DPY32F002Bx5 -Wall -ffunction-sections -fdata-sections -I ./Libraries/CMSIS/Core/Include -I ./Libraries/CMSIS/Device/PY32F0xx/Include -I ./User -I ./Libraries/PY32F002B_HAL_Driver/Inc -I ./Libraries/PY32F002B_HAL_BSP/Inc -I ./Libraries/PY32F0xx_HAL_Driver/Inc -I ./Libraries/PY32F0xx_HAL_BSP/Inc -MT Build/Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.o -o Build/Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.o -c Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.c -MD -MF ./Build/Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.d -MP
In file included from Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.c:191:
./Libraries/PY32F002B_HAL_Driver/Inc/py32f002b_hal.h:33:10: fatal error: py32f002b_hal_conf.h: No such file or directory
   33 | #include "py32f002b_hal_conf.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [rules.mk:99: Build/Libraries/PY32F002B_HAL_Driver/Src/py32f002b_hal_uart.o] Error 1

Any idea what the fix is here? I feel like I must be missing something obvious...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions