Repository navigation
buildsystem: kconfig and cmake - #845
Conversation
|
@lgirdwood |
|
Missing: @lgirdwood |
|
@xiulipan |
|
@jajanusz Only cmake is needed? |
You need Python 3 and Cmake 3.10+. Something like |
|
@jajanusz |
lgirdwood
left a comment
There was a problem hiding this comment.
Good work, looks like it's almost ready to merge.
There was a problem hiding this comment.
So I think the 6 above options are not user configurable but should be enabled/disabled by the platform selection (that same way Linux does this). e.g.
config MEM_WND
bool
and the any platforms that use memory windows would select it
config PLATFORM_APL
bool "build APL blah"
select CONFIG_MEM_WND
etc....
There was a problem hiding this comment.
I will make it like you wrote. It looks like these selects in Linux are used mostly for HAVE_* configs, because they declare capabilites of arch/platform, however I think in the future we should make Kconfig files less platform-oriented.
Problem is in how you define user. What you wrote is good for someone that want to run feature-customized version of FW on already defined platform, but for adding new platform with different HW capabilites it may become unmanagable.
Maybe we should aim for definitions based on multiple configs where you have base+diffs (something more like zephyr than linux).
There was a problem hiding this comment.
@jajanusz Might be easier to have a complete derived config for a platform/board, easier to read complete recipe. Base rather does not change, so no issue with multiple edits.
Another note: how about storing platform/board defs in /platforms, or /boards, not that deep under arch (what about heterogeneous plaforms)?
There was a problem hiding this comment.
@mmaka1 is right that storing it in arch may not be the best idea (even if it's how it's done in kernel)
@mmaka1 @lgirdwood We can always easily change things like these when PR is merged. Kconfig/Cmake are just tools, we can use them however we want for our project.
There was a problem hiding this comment.
Fwiw, Linux does store it's def_configs under arch//configs/ but I don't think we need to do this atm (as Linux easily has hundreds).
@jajanusz yeah, I'm keen to merge and sort out any integration issues after merging, that way all the others can try/test and provide feedback.
@mmaka1 do you approve ? if so I will merge.
There was a problem hiding this comment.
@jajanusz if you are also happy for merging now pls change the PR title to remove the DO NOT MERGE. Thanks.
There was a problem hiding this comment.
@lgirdwood
Still waiting for person responsible for CI to update Internal CI.
I'll let you know when it's done.
There was a problem hiding this comment.
We probably want to prefix platform with PLATFORM_
There was a problem hiding this comment.
I can do this, but I'd have also to change all #ifdefs from CONFIG_APOLLOLAKE to CONFIG_PLATFORM_APOLLOLAKE etc (and create even more mess) . I wanted more direct replacement of autotools for initial support. Cannot we keep it as it is ATM?
There was a problem hiding this comment.
ok, we can refine this later.
There was a problem hiding this comment.
Do we have a menu to select SRC, volume, mixer components ?
There was a problem hiding this comment.
No because there were no CONFIG_ define for it in old buildsystem (or I missed it?).
Anyway you can always easily add it in src/audio/Kconfig
650706f to
fbe0f75
Compare
|
@lgirdwood |
|
@singalsu i havent had the time to test the testbench with this change. have you tried it? |
73c9186 to
33acee7
Compare
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit doesn't touch tools buildsystem. Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
overrideconfig is custom target that can be used to set config values from scripts Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Change DEBUG_BUILD define to use Kconfig's CONFIG_DEBUG Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
b01d9a0 to
fa3bc5a
Compare
|
First question here, is kconfig used by cmake? Then some small question: 1.For some old platforms rom build is not supported, in old build system we can ignore the rom flag is the platform is not support. Could this be support to make make[3]: *** No rule to make target '../src/platform/baytrail/rom.x.in', needed by 'rom.x'. Stop.
CMakeFiles/Makefile2:718: recipe for target 'src/arch/xtensa/CMakeFiles/ld_script_rom.x.dir/all' failed
make[2]: *** [src/arch/xtensa/CMakeFiles/ld_script_rom.x.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 6%] Building ASM object src/arch/xtensa/up/xtos/CMakeFiles/xtos.dir/core-restore.S.obj
In file included from /home/pxl/work/sof/sof/src/arch/xtensa/include/xtensa/config/core.h:50,
from /home/pxl/work/sof/sof/src/arch/xtensa/include/xtensa/coreasm.h:52,
from /home/pxl/work/sof/sof/src/arch/xtensa/up/xtos/core-restore.S:25:
/home/pxl/work/sof/sof/src/platform/baytrail/include/arch/xtensa/config/core-isa.h:8:2: error: #error "No ISA configuration selected"
#error "No ISA configuration selected"
^~~~~
In file included from /home/pxl/work/sof/sof/src/arch/xtensa/up/xtos/core-restore.S:32:
/home/pxl/work/sof/sof/src/platform/baytrail/include/arch/xtensa/config/core-isa.h:8:2: error: #error "No ISA configuration selected"
#error "No ISA configuration selected"
^~~~~
In file included from /home/pxl/work/sof/sof/src/arch/xtensa/up/xtos/core-restore.S:34:
/home/pxl/work/sof/sof/src/arch/xtensa/up/xtos/xtos-internal.h:375:2: error: #error CALL8-only is not supported!
#error CALL8-only is not supported!
^~~~~/home/pxl/work/sof/sof/src/arch/xtensa/boot_loader.c: In function 'boot_master_core':
/home/pxl/work/sof/sof/src/arch/xtensa/boot_loader.c:251:11: error: implicit declaration of function 'hp_sram_init'; did you mean 'list_init'? [-Werror=implicit-function-declaration]
result = hp_sram_init();
^~~~~~~~~~~~
list_init
cc1: all warnings being treated as errors
src/arch/xtensa/CMakeFiles/bootloader.dir/build.make:78: recipe for target 'src/arch/xtensa/CMakeFiles/bootloader.dir/boot_loader.c.obj' failed
|
| USES_TERMINAL | ||
| ) | ||
|
|
||
| if(CONFIG_BUILD_VM_ROM) |
There was a problem hiding this comment.
Please check the platform and compiler used here.
To avoid wrong use and build all use chaos.
There was a problem hiding this comment.
Just change config. It shouldn't be in buildsystem, if you don't want ROM just dont set CONFIG_BUILD_VM_ROM to 'y'.
There was a problem hiding this comment.
Oh, I mean if people mis-used the CONFIG_BUILD_VM_ROM there will be an error. So have another check in CMake will be better.
There was a problem hiding this comment.
Then it should be set in Kconfig files (not cmake) that BUILD_VM_ROM depends on HAVE_ROM and for example platform APOLLOLAKE selects HAVE_ROM. However for me it looks that it's not something bound to platform, more like it's not supported by our CI/qemu/something external yet. Or am I wrong?
| fi | ||
|
|
||
| # only delete binary related to this build | ||
| rm -fr src/arch/xtensa/sof-$j.* |
There was a problem hiding this comment.
More like HOST is not needed, i need toolchain name that is 'xt' or 'xtensa-*-elf'
There was a problem hiding this comment.
I mean rm -fr src/arch/xtensa/sof-$j.* is not needed.
The build result is in the build_*, right?
There was a problem hiding this comment.
Yes you are right.
| --with-root-dir=$ROOT --host=$HOST --enable-debug=$BUILD_DEBUG \ | ||
| CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP \ | ||
| --with-dsp-core=$XTENSA_CORE $BUILD_ROM | ||
| rm -fr build_$j |
There was a problem hiding this comment.
can we also include gcc or xcc in the build dir?
There was a problem hiding this comment.
I don't understand, you specify which one to use with TOOLCHAIN, it's like CROSS_COMPILE in kernel that sets tools in gcc convention (+ in our case sets some cmake specific things).
There was a problem hiding this comment.
yes, so can we parse the name and make the build dir for gcc looks like build_byt_gcc?
In this case, we can compare gcc and xcc build very easily.
There was a problem hiding this comment.
Yes you can do that. However I'm not sure what you want to do, so maybe it would be better if you just update scripts when this buildsystem is merged.
Cmake and Kconfig are 2 different things. Cmake is buildsystem, kconfig is configuration tool (+ defines generator etc), just like in linux/zephyr.
It should be done in script then if you want to disable it. It's user fault if he passes wrong config.
You usually don't use make clean in cmake, take advantage of out-of-tree build and just remove build dir.
Just use differnt build directory. I'll prevent users from doing in-tree build in next PR, to avoid issues exactly like these (other cmake projects do it also). |
|
@jajanusz OK, I will update the scripts later. |
Thanks |
|
@jajanusz any update ? Are we good to merge ? |
Tools subdir has its own buildsystem and this PR doesn't change it.
Please do not merge until CIs are ready for new buildsystem.
If I missed something please let me know in comments.
Cmake version 3.10 or higher is required, it comes with ubuntu 18.04
Docs are coming soon.
Examples below show how to use new buildsystem.
CMake unlike autotools is designed for out-of-tree builds, that's why you should make separate dirs for your configurations (you can manage builds for many confs/arch/platforms from the one source that way).
All snippets below assume that at beginning your working dir is repo root.
Build fw for apollolake with xtensa toolchain:
Build and run unit tests:
Build and install testbench:
If you have ninja installed you can use it instead of make. Just type
cmake -GNinja ...while doing configuration step. Ninja is usually faster than make, especially for incremental builds.Implementation for #228
Tested with CMake versions:
3.10.2 (default for Ubuntu 18.04)
3.13.3 (current)