-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes default paths with empty ENVs, and Checks paths for existence. #244
Conversation
I Updated the PR based on discussion in #240 to use defined ENV check instead of CMake set FORCE optional. On defined ENV a message will be printed to indicate ENV path is being used. If not defined default gets used. After, existence is checked and fatal error thrown if path doesn't exist. Printing ENV message allows single check at the end rather than multiple existence checks. |
cmake/FindCMSIS.cmake
Outdated
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") | ||
endif() | ||
|
||
if (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must check that none of path exists. One is needed but it must not be cube in all cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check for STM32_CMSIS_${FAMILY}_PATH
and updated FATAL_ERROR message.
cmake/FindFreeRTOS.cmake
Outdated
endif() | ||
|
||
if(NOT FREERTOS_PATH) | ||
set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS") | ||
set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS" FORCE) | |
set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
cmake/FindHAL.cmake
Outdated
endif() | ||
|
||
if((NOT STM32_HAL_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH)) | ||
set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") | ||
message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") | ||
endif() | ||
|
||
if (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both paths must be missing to have FATAL_ERROR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added check for STM32_HAL_${FAMILY}_PATH
and updated FATAL_ERROR message.
I just launched the actions. The tests must all pass to merge. Is it possible that the fetch sets the path only after the check ? |
It seems like test/fetch runs for each device family. For each device family it fetches the necessary CMSIS / HAL then runs FindCMSIS.cmake etc. Because the COMPONENTS aren't specified in FindCMSIS.cmake if(NOT CMSIS_FIND_COMPONENTS)
set(CMSIS_FIND_COMPONENTS ${STM32_SUPPORTED_FAMILIES_LONG_NAME})
endif()
...
foreach(COMP ${CMSIS_FIND_COMPONENTS}) This can be seen in previous test output: [100%] Built target stm32-hal-f0-populate
-- Neither STM32_CUBE_F1_PATH nor STM32_CMSIS_F1_PATH specified using default STM32_CUBE_F1_PATH:
-- Neither STM32_CUBE_F2_PATH nor STM32_CMSIS_F2_PATH specified using default STM32_CUBE_F2_PATH:
-- Neither STM32_CUBE_F3_PATH nor STM32_CMSIS_F3_PATH specified using default STM32_CUBE_F3_PATH:
-- Neither STM32_CUBE_F4_PATH nor STM32_CMSIS_F4_PATH specified using default STM32_CUBE_F4_PATH:
-- Neither STM32_CUBE_F7_PATH nor STM32_CMSIS_F7_PATH specified using default STM32_CUBE_F7_PATH:
-- Neither STM32_CUBE_G0_PATH nor STM32_CMSIS_G0_PATH specified using default STM32_CUBE_G0_PATH:
-- Neither STM32_CUBE_G4_PATH nor STM32_CMSIS_G4_PATH specified using default STM32_CUBE_G4_PATH:
-- Neither STM32_CUBE_H7_PATH nor STM32_CMSIS_H7_PATH specified using default STM32_CUBE_H7_PATH:
-- Neither STM32_CUBE_H7_PATH nor STM32_CMSIS_H7_PATH specified using default STM32_CUBE_H7_PATH:
-- Neither STM32_CUBE_L0_PATH nor STM32_CMSIS_L0_PATH specified using default STM32_CUBE_L0_PATH:
-- Neither STM32_CUBE_L1_PATH nor STM32_CMSIS_L1_PATH specified using default STM32_CUBE_L1_PATH:
-- Neither STM32_CUBE_L4_PATH nor STM32_CMSIS_L4_PATH specified using default STM32_CUBE_L4_PATH:
-- Neither STM32_CUBE_L5_PATH nor STM32_CMSIS_L5_PATH specified using default STM32_CUBE_L5_PATH:
-- Found CMSIS: /home/runner/work/stm32-cmake/tests/fetch/build/_deps/stm32-cmsis-src/Include;/home/runner/work/stm32-cmake/tests/fetch/build/_deps/stm32-cmsis-f0-src/Include (found version "5.6.0") found components: STM32F0 missing components: STM32F1 STM32F2 STM32F3 STM32F4 STM32F7 STM32G0 STM32G4 STM32H7_M4 STM32H7_M7 STM32L0 STM32L1 STM32L4 STM32L5
-- Search for HAL families: STM32F0;STM32F1;STM32F2;STM32F3;STM32F4;STM32F7;STM32G0;STM32G4;STM32H7_M4;STM32H7_M7;STM32L0;STM32L1;STM32L4;STM32L5
-- Search for HAL drivers: adc;can;cec;comp;cortex;crc;dac;dma;exti;flash;gpio;i2c;i2s;irda;iwdg;pcd;pwr;rcc;rtc;smartcard;smbus;spi;tim;tsc;uart;usart;wwdg;eth;hcd;mmc;nand;nor;pccard;sd;sram;cryp;dcmi;hash;rng;hrtim;opamp;sdadc;dfsdm;dma2d;dsi;flash_ramfunc;fmpi2c;lptim;ltdc;qspi;sai;sdram;spdifrx;jpeg;mdios;cordic;fdcan;fmac;dts;gfxmmu;hsem;mdma;ospi;otfdec;pssi;ramecc;swpmi;firewall;lcd;pka;gtzc;icache
-- Search for HAL LL drivers: adc;comp;crc;crs;dac;dma;exti;gpio;i2c;pwr;rcc;rtc;spi;tim;usart;usb;utils;fsmc;sdmmc;rng;fmc;hrtim;opamp;dma2d;lptim;lpuart;ucpd;cordic;fmac;bdma;delayblock;mdma;swpmi;pka
-- Could not read the HAL version from package.xml for STM32F0
-- Neither STM32_CUBE_F1_PATH nor STM32_HAL_F1_PATH specified using default STM32_CUBE_F1_PATH:
-- Could not read the HAL version from package.xml for STM32F1
-- Neither STM32_CUBE_F2_PATH nor STM32_HAL_F2_PATH specified using default STM32_CUBE_F2_PATH:
-- Could not read the HAL version from package.xml for STM32F2
-- Neither STM32_CUBE_F3_PATH nor STM32_HAL_F3_PATH specified using default STM32_CUBE_F3_PATH:
-- Could not read the HAL version from package.xml for STM32F3
-- Neither STM32_CUBE_F4_PATH nor STM32_HAL_F4_PATH specified using default STM32_CUBE_F4_PATH:
-- Could not read the HAL version from package.xml for STM32F4
-- Neither STM32_CUBE_F7_PATH nor STM32_HAL_F7_PATH specified using default STM32_CUBE_F7_PATH:
-- Could not read the HAL version from package.xml for STM32F7
-- Neither STM32_CUBE_G0_PATH nor STM32_HAL_G0_PATH specified using default STM32_CUBE_G0_PATH:
-- Could not read the HAL version from package.xml for STM32G0
-- Neither STM32_CUBE_G4_PATH nor STM32_HAL_G4_PATH specified using default STM32_CUBE_G4_PATH:
-- Could not read the HAL version from package.xml for STM32G4
-- Neither STM32_CUBE_H7_PATH nor STM32_HAL_H7_PATH specified using default STM32_CUBE_H7_PATH:
-- Could not read the HAL version from package.xml for STM32H7_M4
-- Neither STM32_CUBE_H7_PATH nor STM32_HAL_H7_PATH specified using default STM32_CUBE_H7_PATH:
-- Could not read the HAL version from package.xml for STM32H7_M7
-- Neither STM32_CUBE_L0_PATH nor STM32_HAL_L0_PATH specified using default STM32_CUBE_L0_PATH:
-- Could not read the HAL version from package.xml for STM32L0
-- Neither STM32_CUBE_L1_PATH nor STM32_HAL_L1_PATH specified using default STM32_CUBE_L1_PATH:
-- Could not read the HAL version from package.xml for STM32L1
-- Neither STM32_CUBE_L4_PATH nor STM32_HAL_L4_PATH specified using default STM32_CUBE_L4_PATH:
-- Could not read the HAL version from package.xml for STM32L4
-- Neither STM32_CUBE_L5_PATH nor STM32_HAL_L5_PATH specified using default STM32_CUBE_L5_PATH:
-- Could not read the HAL version from package.xml for STM32L5
-- Found HAL: /home/runner/work/stm32-cmake/tests/fetch/build/_deps/stm32-hal-f0-src/Inc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/runner/work/stm32-cmake/tests/fetch/build Seems like the test needs to be modifed to populate the correct COMPONENTS based on TEST_FAMILIES. I'm not familiar enough with CMake Syntax to figure out how to do that idiomatically; my first hack would be to create a list, iterate over TEST_FAMILIES, and append to the list. |
I found out how to idiomatically prepend lists and have pushed an update to test. Two notes:
|
Thank you for update.
@Hish15 what do you think of this ? |
@BenArtes
Thank you for your time and sorry if this is a bit long. We try to avoid breaking changes and partial fixes when we see something that needs improvements. |
I'm happy to make whatever changes are necessary. I added the existence checks to this PR because they seemed relevant and like a small change; it now seems like they are a larger change that needs more discussion. Should I pull those changes to a new PR for that further discussion, leaving just the default value fix for this PR? I think I know the solution for this issue, but we'll likely need to discuss test changes and document changes etc. Side Note: I wish to cleanup this PR Branch to remove erroneous commits etc, I believe github handles force pushes correctly and will update the PR, should I go ahead and do that? |
Glad to read you are motivated to help. Then do a different PR for the |
Paths are only set if ENV is defined.
e69373d
to
278c875
Compare
@Hish15 Go |
Closes #240, by checking ENV path exists before setting it