You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/30 15:36:52 UTC

[GitHub] [incubator-nuttx] protobits opened a new pull request #3704: Migrate build system to CMake

protobits opened a new pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704


   ## Summary
   
   This is an incomplete work in progress. The PR is against a separate branch so this can eventually be merged and then finished incrementally on that branch.
   
   Note that this depends on accompanying apps/ change (which I have in my fork's cmake branch: [master..releases/cmake compare link](https://github.com/apache/incubator-nuttx-apps/compare/master...protobits:releases/cmake)).
   
   Currently this work on limited host/target platforms but has most features supported. It mainly needs testing before moving on to other platforms. If you want to contribute, please let me know.
   
   ## Some changes to mention
   
   1. Since the goal is to allow for out-of-tree builds, the context step does not create symlinks inside source tree, but in build directory. Include path is extended to expose this as expected
   2. Debug/Release flags are handled via CMAKE_BUILD_TYPE as expected, not from config options (relevant options are still present on Kconfig, this would eventually be removed)
   3. APPDIR is taken from cmake command line, not from config
   4. `CONFIG_HOST_*` is received via environment variables from CMake
   5. Various cmake `nuttx_*` functions are defined for handling typical build setups
   6. apps/Kconfig is no longer build-time generated but it is now a static file
   
   ## TODO
   
   The following are not yet addressed
   
   - kernel/~protected~ build: don't have a board to test it
   - other arch/boards: only sim and one board supported right now
   - custom boards (currently disabled inclusion of boards/dummy/Kconfig)
   - Complete removal of optimization flags from Kconfig, this is handled via CMAKE_BUILD_TYPE
   - ~Support module building (extend nuttx_add_application to take a symbol)~ update all apps to include MODULE keyword back
   - export: probably needs redesign using cmake (provide one with current behavior for now)
   - Add a flash target (debug also?), and other useful ones
   - how to deal with apps building host code? in CMake this would be an external project but this doesn't seem to be the best option
   - Perform extensive testing on other target and host platforms
   - Document the build system under Documentation/ (design and how to add board/arch/app)
   - macOS: requires GNU toolchain to create ELF binaries. this complicates build since a different toolchain is needed for only part of the build. ideally we would use this toolchain for the complete build but it is not certain that this is possible. will need to look into further: currently i'm linking a static lib using standard toolchain and then create the elf binary with elf-gcc. This needs to be tested.
   
   ## Conversion progress
   
   This is how far I got the conversion, which allows most sim configs to build. 
   
   ### Apps
   
   - [x] apps/builtin
   - [x] apps/canutils
   - [ ] apps/examples
     - [ ] apps/examples/audio_rttl: depends on external Make.defs from SDK. would need a working config to test this
     - [ ] apps/examples/nxflat: need help understanding this
     - [ ] apps/examples/thttpd
     - [x] rest
   - [x] apps/fsutils
   - [x] apps/graphics
   - [x] apps/gpsutils
   - [ ] apps/import: what is the purpose of this?
   - [x] apps/industry
   - [x] apps/interpreters
   - [x] apps/modbus
   - [ ] apps/netutils
     - [ ] apps/netutils/thttpd
     - [x] rest
   - [x] apps/nshlib
   - [ ] apps/platform
   - [x] apps/system
   - [ ] apps/testing
     - [ ] apps/testing/ltp
     - [x] rest 
   - [x] apps/tools
   - [ ] apps/wireless
     - [ ] apps/wireless/nimble
     - [x] rest
   
   ### NuttX
   
   - [ ] nuttx/arch
     - [x] nuttx/arch/arm/src/armv7-m
     - [x] nuttx/arch/arm/src/common
     - [x] nuttx/arch/arm/src/stm32
     - [x] nuttx/arch/sim
     - [ ] rest
   - [ ] nuttx/audio
   - [x] nuttx/binfmt
   - [ ] nuttx/boards
     - [x] nuttx/boards/sim/sim/sim (tested: nsh)
     - [x] nuttx/boards/arm/stm32/stm32f103-minimum (built: nsh)
     - [x] nuttx/boards/arm/stm32/stm32f4discovery (built: nsh, ostest passed)
     - [ ] rest
   - [x] nuttx/crypto
   - [x] nuttx/drivers
   - [x] nuttx/fs
   - [x] nuttx/graphics
   - [x] nuttx/libs
     - [x] nuttx/libs/libc
     - [x] nuttx/libs/libdsp
     - [x] nuttx/libs/libnx
     - [x] nuttx/libs/libxx
   - [x] nuttx/mm
   - [x] nuttx/net
   - [x] nuttx/openamp
   - [x] nuttx/sched
   - [x] nuttx/syscall: need help understanding how to handle this
   - [ ] nuttx/tools: only basic binaries for now, this directory is quite messy. it is hard to know how to handle each tool/script
   - [x] nuttx/video
   - [x] nuttx/wireless
   
   ## Impact
   
   Major, this should probably be part of a major NuttX release. 
   
   ## Testing
   
   Boards currently building, on macOS and Linux:
   
   - sim
   - stm32f4discovery
   
   ### How to test
   
   From within `nuttx/`. Configure:
   
       cmake -B build -DNUTTX_BOARD=sim/sim/sim -DNUTTX_CONFIG=nsh -GNinja
   
   This uses ninja generator (install with `sudo apt install ninja-build`). To build:
   
       cmake --build build
   
   menuconfig:
   
       cmake --build build -t menuconfig
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-842693496


   BTW, I have updated the PR description where I tried to point out the areas where I'm currently needing some help (per nuttx directory and sim configs not currently building). If anyone could give some guidance on how these parts of nuttx work it would be really helpful.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-842619050


   I'm trying to pick this up a bit and get it to build on CI. I'm working on the Linux build but on macOS it reports that static libraries have no symbols. Could someone on macos try to build and see what could be the issue? For reference on how to build see the testbuild.sh script (which can be used locally to test).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-849920112


   > > Note that I'm on a branch based on a commit about a month ago from now. So that PR could not have been it. Maybe it is actually functional on master.
   > 
   > Could this be a cockpit error? Have you ever used the PROTECTED build in the past? You know that when the build completes, there will be two ELF files, nuttx and nuttx-user. Both have to be loaded into FLASH. There should be more info in the README file associated with each configuration.
   
   Indeed this is the first I tried it but I saw the README you mentioned. I flashed both binaries at apropriate FLASH addresses and the test runs for quite some time until it crashes. I wouldn't worry until it is confirmed that this happens on master as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-849823594


   > I just managed to have PROTECTED build working, tested on stm32f4discovery (it actually hardfaults but this happens when building with unmodified nuttx as well, so I guess it is not really functional ATM).
   
   That is bad.  Could this be a result of  #3626?  That PR certainly has the ability to break the PROTECTED build.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] protobits commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
protobits commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858596866


   > Separate branch is definitely a showstopper. I am willing to migrate my custom board to cmake, but if it is in separate branch I will stuck to this branch. When it will be in the master branch, more people will test it.
   > 
   > Let's think how it can be merged to master as soon as possible. Cmake may be incomplete. The main condition to merge to the master is that the make shouldn't be altered.
   > 
   > Let's start.
   > Choices can be returned to the top Kconfig
   > 
   > ```
   > +choice
   > +	prompt "Build Host Platform"
   > +	default HOST_LINUX
   > +
   >  config HOST_LINUX
   > -	bool
   > +	bool "Linux"
   >  	option env="HOST_LINUX"
   >  
   >  config HOST_MACOS
   > -	bool
   > +	bool "macOS"
   >  	option env="HOST_MACOS"
   >  
   >  config HOST_WINDOWS
   > -	bool
   > +	bool "Windows"
   >  	option env="HOST_WINDOWS"
   >  
   >  config HOST_OTHER
   > -	bool
   > +	bool "Other"
   >  	option env="HOST_OTHER"
   >  
   > +endchoice
   > ```
   > 
   > The drivers Kconfig can have defaults
   > 
   > ```
   > config DRIVERS_PLATFORM_DIR
   >         string
   >         option env="DRIVERS_PLATFORM_DIR"
   > 		default "drivers/platform"
   > 
   > source "$DRIVERS_PLATFORM_DIR/Kconfig"
   > ```
   > 
   > Now I can build stm32f4discovery with make and with cmake.
   
   You can't provide various defaults to the choice. In any case, sethost.sh could be adapted to supply the corresponding variable I believe.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] btashton commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
btashton commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-845516625


   Sorry @v01d I have been on-call this week which has not left me with much time/focus to look, but I will set some time aside this weekend.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-846446688


   > Build now passes on Linux for sim. I will try to have a look at some board with protected/kernel build to complete that as well.
   > BTW, I think one of the macos failures right now is a problem where the default macos linker is not able to create ELF executables and the makefiles used the gnu toolchain for this. I'm interested in your input on this since I'm thinking that we could then make sim on macos to use the gnu toolchain for the complete build (otherwise it gets unnecessarily complex to support this corner case). What do you think?
   
   I made a similar proposal before, but @ymat said that it's impossible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-845522871


   Sure! Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-849765532


   I just managed to have PROTECTED build working, tested on stm32f4discovery (it actually hardfaults but this happens when building with unmodified nuttx as well, so I guess it is not really functional ATM). I don't have a board to test KERNEL mode so I cannot test that but I think that the build system most likely already supports it.
   I will add it to the testlist so that stm32f4discovery configs are built in CI as well.
   
   I think things now are very close to a "minimal" POC so I think it could be easier for others to test (on sim and stm32f4discovery and review the approach so far). After that, I will need help to finish porting to other arch and boards (I can do the groundwork) and test on macos and maybe even windows, mostly by local build and ostest testing. So, I would like to ask if someone is willing to give a hand to complete this. I will provide any needed information on how to do so.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858060072


   @protobits I think it is better to wait other people to manifest before closing this PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d edited a comment on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d edited a comment on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-842619050


   I'm trying to pick this up a bit and get it to build on CI. I'm working on the Linux build but on macOS it reports that static libraries have no symbols. Could someone on macos try to build and see what could be the issue (@btashton?)? For reference on how to build see the testbuild.sh script (which can be used locally to test).
   
   EDIT: there's also an issue with sed (called from main CMakeLists.txt) to edit linker script for nuttx.rel which I'm not sure why is happening.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851480208


   I just squashed the commits. There's still one big commit with the addition of all cmake files, but it is not really possible to further split it into meaningful ones. There's one commit about modifying some defconfigs which is not really needed right now but it would be good to apply to master anyway.
   
   This can still be reworked as needed so don't worry about a detailed review. If you could download the branch (along the change in apps) and perform some tests that would be great. If you need more guidance/information, let me know.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851226569


   @v01d can you rearrange the patchset? So, we can review it more easier.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] acassis commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858559595


   Hi @AlexanderVasiljev and @protobits yes, if we get cmake and make working side by side without one interfering in the other, then we could merge the initial support, it will make things easier to test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851665085


   > > I just managed to have PROTECTED build working, tested on stm32f4discovery (it actually hardfaults but this happens when building with unmodified nuttx as well, so I guess it is not really functional ATM).
   > 
   > That is bad. Could this be a result of #3626? That PR certainly has the ability to break the PROTECTED build.
   
   I verified that the current master behaves in the same way.  Although it does hardfault, this is not due to #3626 since many, many pthreads start and exit before the hardfault occurs.  The culprit appears to be a recent change to vfork() logic that gets exercised by the OS test.  I opened #3812
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-871509827


   Let's restore the PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlexanderVasiljev commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
AlexanderVasiljev commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-859626823






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] protobits closed pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
protobits closed pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlexanderVasiljev edited a comment on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
AlexanderVasiljev edited a comment on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-859626823


   sethost.sh is linux specific. We can execute kconfig-tweak from Cmake
   
   ```
    set(NUTTX_DEFCONFIG_SAVED ${NUTTX_DEFCONFIG} CACHE INTERNAL "Saved defconfig path" FORCE)
    
   +  if(APPLE)
   +	execute_process(COMMAND  kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_MACOS
   +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_LINUX
   +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +  elseif(WIN32)
   +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_WINDOWS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_LINUX
   +				  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +  elseif(UNIX)
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_LINUX
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +  else()
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_LINUX
   +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   +  endif()
      # Print configuration choices
    
      message(STATUS "  Board: ${NUTTX_BOARD}")
      message(STATUS "  Config: ${NUTTX_CONFIG}")
      message(STATUS "  Appdir: ${NUTTX_APPS_DIR}")
   ```
   
   So we will not alter top Kconfig.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-847428257


   > > Build now passes on Linux for sim. I will try to have a look at some board with protected/kernel build to complete that as well.
   > > BTW, I think one of the macos failures right now is a problem where the default macos linker is not able to create ELF executables and the makefiles used the gnu toolchain for this. I'm interested in your input on this since I'm thinking that we could then make sim on macos to use the gnu toolchain for the complete build (otherwise it gets unnecessarily complex to support this corner case). What do you think?
   > 
   > I made a similar proposal before, but @ymat said that it's impossible.
   
   OK, thanks. I will add a way to support using a separate toolchain for module building then.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-848283946


   > > > Build now passes on Linux for sim. I will try to have a look at some board with protected/kernel build to complete that as well.
   > > > BTW, I think one of the macos failures right now is a problem where the default macos linker is not able to create ELF executables and the makefiles used the gnu toolchain for this. I'm interested in your input on this since I'm thinking that we could then make sim on macos to use the gnu toolchain for the complete build (otherwise it gets unnecessarily complex to support this corner case). What do you think?
   > > 
   > > 
   > > I made a similar proposal before, but @ymat said that it's impossible.
   > 
   > OK, thanks. I will add a way to support using a separate toolchain for module building then.
   
   It seems this will be a bit difficult. CMake does not make it easy to use different compiler inside the same project. Not impossible I guess but I haven't found a way.
   
   BTW, I managed to get stm32f4discovery building and passing ostest. I chose this board to be able to test PROTECTED/KERNEL mode, which is the only major feature missing. After that it should be mostly about completing apps (not many missing) and all arch/boards, as well as testing on other host platforms.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] protobits commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
protobits commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-859631957


    
   
   > sethost.sh is linux specific. We can execute kconfig-tweak from Cmake
   > 
   > ```
   >  set(NUTTX_DEFCONFIG_SAVED ${NUTTX_DEFCONFIG} CACHE INTERNAL "Saved defconfig path" FORCE)
   >  
   > +  if(APPLE)
   > +	execute_process(COMMAND  kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   > +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_MACOS
   > +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_LINUX
   > +					WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +  elseif(WIN32)
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_WINDOWS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_LINUX
   > +				  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +  elseif(UNIX)
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_LINUX
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +  else()
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_WINDOWS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --disable CONFIG_HOST_MACOS
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +	  execute_process(COMMAND kconfig-tweak  --file .config --enable CONFIG_HOST_LINUX
   > +					  WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
   > +  endif()
   >    # Print configuration choices
   >  
   >    message(STATUS "  Board: ${NUTTX_BOARD}")
   >    message(STATUS "  Config: ${NUTTX_CONFIG}")
   >    message(STATUS "  Appdir: ${NUTTX_APPS_DIR}")
   > ```
   > 
   > So we will not alter top Kconfig.
   
   I'd rather not go backwards, since I moved away from changing those settings using kconfig-tweak. Passing environment variables to kconfig-mconf and such is already being done, so adding the option of setting CONFIG_HOST_ the same way is preferable. 
   
   The end goal would be to remove these variables from config files altogether since it is problematic when .config has a host setting different than the platform (there's also no point in storing that information in a .config).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-850866001


   Build now passes on both targets supported so far.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851492358


   > Note that you will see partially migrated files for other SoC than stm32 or other arch's. That is not really functional yet so you can ignore it.
   
   I just removed these files to make the patchset a bit smaller.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-845378978


   I managed to have all sim configs building on Linux (although I haven't yet tried to run nuttx in each case since I'm not entirely sure what to run). I will confirm this once CI comes back alive. 
   The issues with macOS persist though. @btashton by any chance did you get to try it? @yamt you're on macos, right?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] jerpelea commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
jerpelea commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851232973


   @v01d please squash the patches and add commit messages for commits


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlexanderVasiljev commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
AlexanderVasiljev commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858600351


   This is Kconfig localy on my PC. I can open menu with "make menuconfig" and with "cmake --build build -t menuconfig".
   
   ```
   choice
           prompt "Build Host Platform"
           default HOST_LINUX
   
   config HOST_LINUX
           bool "Linux"
           option env="HOST_LINUX"
   
   config HOST_MACOS
           bool "macOS"
           option env="HOST_MACOS"
   
   config HOST_WINDOWS
           bool "Windows"
           option env="HOST_WINDOWS"
   
   config HOST_OTHER
           bool "Other"
           option env="HOST_OTHER"
   
   endchoice
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-846128449


   Build now passes on Linux for sim. I will try to have a look at some board with protected/kernel build to complete that as well.
   BTW, I think one of the macos failures right now is a problem where the default macos linker is not able to create ELF executables and the makefiles used the gnu toolchain for this. I'm interested in your input on this since I'm thinking that we could then make sim on macos to use the gnu toolchain for the complete build (otherwise it gets unnecessarily complex to support this corner case). What do you think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-851481754


   Note that you will see partially migrated files for other SoC than stm32 or other arch's. That is not really functional yet so you can ignore it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] patacongo commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
patacongo commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-849915879


   > Note that I'm on a branch based on a commit about a month ago from now. So that PR could not have been it. Maybe it is actually functional on master.
   
   Could this be a cockpit error?  Have you ever used the PROTECTED build in the past?  You know that when the build completes, there will be two ELF files, nuttx and nuttx-user.  Both have to be loaded into FLASH.  There should be more info in the README file associated with each configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] protobits commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
protobits commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858631878


   Sorry I though you were passing multiple defaults. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] v01d commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
v01d commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-849866592


   > > I just managed to have PROTECTED build working, tested on stm32f4discovery (it actually hardfaults but this happens when building with unmodified nuttx as well, so I guess it is not really functional ATM).
   > 
   > That is bad. Could this be a result of #3626? That PR certainly has the ability to break the PROTECTED build.
   
   Note that I'm on a branch based on a commit about a month ago from now. So that PR could not have been it. Maybe it is actually functional on master.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] davids5 commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-840657025


   @v01d I sent small PR to your fork


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] AlexanderVasiljev commented on pull request #3704: Migrate build system to CMake

Posted by GitBox <gi...@apache.org>.
AlexanderVasiljev commented on pull request #3704:
URL: https://github.com/apache/incubator-nuttx/pull/3704#issuecomment-858478406


   Separate branch is definitely a showstopper.  I am willing to migrate my custom board to cmake, but if it is in separate branch I will stuck to this branch. When it will be in the master branch, more people will test it.
   
   Let's think how it can be merged to master as soon as possible. Cmake may be incomplete. The main condition to merge to the master is that the make shouldn't be altered.
   
   Let's start.
   Choices can be returned to the top Kconfig
   
   ```
   +choice
   +	prompt "Build Host Platform"
   +	default HOST_LINUX
   +
    config HOST_LINUX
   -	bool
   +	bool "Linux"
    	option env="HOST_LINUX"
    
    config HOST_MACOS
   -	bool
   +	bool "macOS"
    	option env="HOST_MACOS"
    
    config HOST_WINDOWS
   -	bool
   +	bool "Windows"
    	option env="HOST_WINDOWS"
    
    config HOST_OTHER
   -	bool
   +	bool "Other"
    	option env="HOST_OTHER"
    
   +endchoice
   ```
   
   The drivers Kconfig can have defaults
   
   ```
   config DRIVERS_PLATFORM_DIR
           string
           option env="DRIVERS_PLATFORM_DIR"
   		default "drivers/platform"
   
   source "$DRIVERS_PLATFORM_DIR/Kconfig"
   ```
   
   Now I can build stm32f4discovery with make and with cmake.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org