Git Product home page Git Product logo

Comments (10)

gdobato avatar gdobato commented on September 7, 2024 1

Hello Joel,

Ok, thank you.

  • Cmake: 3.13.4

  • GCC:
    For Stm32 targets: gcc-arm-none-eabi-8-2019-q3-update
    For x86_64-linux host: x86_64-linux-gnu 9.2.1 (20191008)

  • OS: I have tested it in Debian 10 and Ubuntu 19.10 ( I switched to Ubuntu thinking that something in my Debian environment was wrong..., but I got the same results)

Please, note that the initial CMake support 66c2670 is also working on my side, I experienced these issues after the commit 488b7fe for clang support. In the initial support, the cache variable TRIPLE is used directly in execute_process, and the toolchain file does not use $APP and ${CMAKE_EXECUTABLE_SUFFIX}...

Best regards,
Gabriel

from real-time-cpp.

jwinarske avatar jwinarske commented on September 7, 2024 1

Thanks Gabriel. Fix is pending in PR #48

from real-time-cpp.

ckormanyos avatar ckormanyos commented on September 7, 2024

It seems that the variable GCC_TOOLCHAIN_PREFIX is not right set in some places. E.g, by execute_process, should it not be used as ENV variable?

Thank you Gabriel. I will investigate this.

Kind regards, Chris

from real-time-cpp.

jwinarske avatar jwinarske commented on September 7, 2024

Hi @gdobato . Please follow this pattern, and let us know how it works.

Linux Native / Host Build
real-time-cpp$ mkdir build_linux_host && cd build_linux_host
real-time-cpp$ cmake ../ref_app -DTRIPLE=x86_64-linux-gnu -DTARGET=host -DCMAKE_TOOLCHAIN_FILE=../ref_app/cmake/gcc-toolchain.cmake
real-time-cpp$ make -j7

Also the toolchain bin directory should be in your path.

from real-time-cpp.

gdobato avatar gdobato commented on September 7, 2024

Hello @ckormanyos , hello @jwinarske,
Thanks for the answer.

Using the given pattern I get the same errors....
I investigated a little and I think I found the issue. There are 2 main problems:

1 )In the toolchain file, in execute_process, there is an additional "-" after the variable ${GCC_TOOLCHAIN_PREFIX} (which is already set in set(GCC_TOOLCHAIN_PREFIX ${TRIPLE}-) and consequently, the "which" command is not able to find the path, so the BINUTILS_PATH is not set either.

By removing the "-" this issue is solved.

2 )In the same file, the variables ${APP} and ${CMAKE_EXECUTABLE_SUFFIX} are used, but they are set in the specific target script. As a consequence, some variables (POSTBUILD_GEN_SYMBOL_LISTING, POSTBUILD_GEN_HEX, ...) are not right set, and there are errors in the postbuild phase...

As the specific target script cannot be included in gcc-toolchain.cmake since the toolchain file has no access to the cache variable ${TARGET}, this can be fixed by moving all definitions which make use of $APP and ${CMAKE_EXECUTABLE_SUFFIX} from gcc-toolchain.cmake to the root CMakeList.txt, since this one includes the specific target script.

Please, find attached a patch with the modifications. By applying it, I can build and install all output files in a Linux System, but I did not test it in Win, Apple or/and VS environment.

001-Fix-unix-build.txt

Best regards,
Gabriel

from real-time-cpp.

jwinarske avatar jwinarske commented on September 7, 2024

Hi Gabriel,

I'll double check things build tomorrow. What's your environment? OS, toolchain, etc.

I did all the initial CMake work on Ubuntu 18.04 with all of the Toolchains.

Joel

from real-time-cpp.

ckormanyos avatar ckormanyos commented on September 7, 2024

I investigated a little and I think I found the issue. There are 2 main problems

I'll double check things build tomorrow. What's your environment? OS, toolchain, etc.
I did all the initial CMake work on Ubuntu 18.04 with all of the Toolchains.

Thanks Joel and Gabriel.

from real-time-cpp.

gdobato avatar gdobato commented on September 7, 2024

Hello Chris and Joel,
Great thanks .
However the PR #48 only fixes partially the issue. The variable ${CMAKE_EXECUTABLE_SUFFIX} is not defined in gcc-toolchain.cmake, and the post-build is still broken. E.g in the case below should be elf, but it is empty:

_+message (STATUS "Executable Suffix ... ${CMAKE_EXECUTABLE_SUFFIX}")
set(POSTBUILD_GEN_SYMBOL_LISTING ${READELF} --syms ${APP}${CMAKE_EXECUTABLE_SUFFIX} > ${APP}readelf.txt)
set(POSTBUILD_GEN_HEX ${OBJCOPY} -O ihex ${APP}${CMAKE_EXECUTABLE_SUFFIX} ${APP}.hex)

gdobato@unix:~/Workspace/real-time-cpp/build$ cmake ../ref_app -DTRIPLE=arm-none-eabi -DTARGET=stm32f429 -DCMAKE_TOOLCHAIN_FILE=../ref_app/cmake/gcc-toolchain.cmake
-- CMAKE_BUILD_TYPE not set, defaulting to MinSizeRel.
-- Triple ................. arm-none-eabi
-- Triple Arch ............ arm
-- Toolchain Path ......... /home/gdobato/Workspace/MCUPlatform/target/tools/toolchain/LINUX/gcc-arm-none-eabi-8-2019-q3-update/bin
-- Executable Suffix ...  
-- Triple ................. arm-none-eabi
-- Triple Arch ............ arm
-- Toolchain Path ......... /home/gdobato/Workspace/MCUPlatform/target/tools/toolchain/LINUX/gcc-arm-none-eabi-8-2019-q3-update/bin
-- Executable Suffix ...  
-- The CXX compiler identification is GNU 8.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /home/gdobato/Workspace/MCUPlatform/target/tools/toolchain/LINUX/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc
-- Check for working CXX compiler: /home/gdobato/Workspace/MCUPlatform/target/tools/toolchain/LINUX/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /home/gdobato/Workspace/MCUPlatform/target/tools/toolchain/LINUX/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Generator .............. Unix Makefiles
-- Build Type ............. MinSizeRel
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gdobato/Workspace/real-time-cpp/build
gdobato@unix:~/Workspace/real-time-cpp/build$ make -j
Scanning dependencies of target ref_app
[  2%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_crc.cpp.obj
[  5%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark.cpp.obj
[  8%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_fast_math.cpp.obj
[ 13%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_complex.cpp.obj
[ 16%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_wide_integer.cpp.obj
[ 16%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_fixed_point.cpp.obj
[ 18%] Building CXX object CMakeFiles/ref_app.dir/src/app/led/app_led.cpp.obj
[ 21%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_filter.cpp.obj
[ 24%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_cpu.cpp.obj
[ 27%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_float.cpp.obj
[ 29%] Building CXX object CMakeFiles/ref_app.dir/src/app/benchmark/app_benchmark_pi_spigot.cpp.obj
[ 32%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_eep.cpp.obj
[ 35%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_gpt.cpp.obj
[ 37%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_irq.cpp.obj
[ 40%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_osc.cpp.obj
[ 43%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_led.cpp.obj
[ 45%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_pwm.cpp.obj
[ 48%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_port.cpp.obj
[ 51%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_spi.cpp.obj
[ 54%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_wdg.cpp.obj
[ 56%] Building CXX object CMakeFiles/ref_app.dir/src/os/os_task_control_block.cpp.obj
[ 59%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/mcal.cpp.obj
[ 62%] Building CXX object CMakeFiles/ref_app.dir/src/os/os.cpp.obj
[ 64%] Building CXX object CMakeFiles/ref_app.dir/src/sys/idle/sys_idle.cpp.obj
[ 67%] Building CXX object CMakeFiles/ref_app.dir/src/sys/mon/sys_mon.cpp.obj
[ 70%] Building CXX object CMakeFiles/ref_app.dir/src/sys/start/sys_start.cpp.obj
[ 72%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/stm32f429/mcal_osc_detail.cpp.obj
[ 78%] Building CXX object CMakeFiles/ref_app.dir/src/util/STD_LIBC/memory.cpp.obj
[ 81%] Building CXX object CMakeFiles/ref_app.dir/src/util/STL/impl/arm/arm_float_limits.cpp.obj
[ 81%] Building CXX object CMakeFiles/ref_app.dir/src/mcal/mcal_gcc_cxx_completion.cpp.obj
[ 83%] Building CXX object CMakeFiles/ref_app.dir/src/util/STL/impl/cmath_impl_gamma.cpp.obj
[ 86%] Building CXX object CMakeFiles/ref_app.dir/src/util/STL/impl/cmath_impl_hyperbolic.cpp.obj
[ 89%] Building CXX object CMakeFiles/ref_app.dir/target/micros/stm32f429/startup/crt0.cpp.obj
[ 91%] Building CXX object CMakeFiles/ref_app.dir/target/micros/stm32f429/startup/crt0_init_ram.cpp.obj
[ 94%] Building CXX object CMakeFiles/ref_app.dir/target/micros/stm32f429/startup/int_vect.cpp.obj
[ 97%] Building CXX object CMakeFiles/ref_app.dir/target/micros/stm32f429/startup/crt1.cpp.obj
[100%] Linking CXX executable ref_app.elf
Generating Post Build Artifacts
readelf: Error: 'ref_app': No such file
make[2]: *** [CMakeFiles/ref_app.dir/build.make:615: ref_app.elf] Error 1
make[2]: *** Deleting file 'ref_app.elf'
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/ref_app.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

is it building on your side?
Thanks,
Gabriel

from real-time-cpp.

jwinarske avatar jwinarske commented on September 7, 2024

PR #49

I broke this when I refactored the post-build steps, and missed the executable suffix. The change gives the gcc toolchain a default of .elf. If there is ever a need for non-.elf, the post build stuff will need to move into the target include.

from real-time-cpp.

ckormanyos avatar ckormanyos commented on September 7, 2024

This should now be fixed with PR #49

from real-time-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.