Commit graph

7 commits

Author SHA1 Message Date
Torsten Rasmussen 52301d97c5 cmake: kconfig: fix issue if Kconfig symbol name contains lower case
Fixes: #40420

If a Kconfig has lower case in its symbol name, then the file configs.c
is wrongly generated.

For example a Kconfig snippet like this:
> config FAIL_this
> 	bool "Test fail"
> 	default y

will create an autoconf.h containing this:
> #define CONFIG_FAIL_this 1

but the configs.c will wrongly contain the same
> #define CONFIG_FAIL_this 1

instead of:
> GEN_ABSOLUTE_SYM_KCONFIG(CONFIG_FAIL_this, 1);

which results in following error at compile time
.../build/zephyr/misc/generated/configs.c: In function '_ConfigAbsSyms':
.../build/zephyr/misc/generated/configs.c:309: warning:
    "CONFIG_FAIL_this" redefined
  309 | #define CONFIG_FAIL_this 1;
      |
In file included from <command-line>:
.../build/zephyr/include/generated/autoconf.h:299: note: this is the
  location of the previous definition
  299 | #define CONFIG_FAIL_this 1
      |

The file misc/generated/CMakeLists.txt has been updated to correctly
handled lower casing in Kconfig symbol names.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-11-18 13:56:07 +01:00
Daniel Leung 92c12d1f82 toolchain: add GEN_ABSOLUTE_SYM_KCONFIG()
This adds a new GEN_ABSOLUTE_SYM_KCONFIG() specifically for
generating absolute symbols in assembly for kconfig values.
This is needed as the existing GEN_ABSOLUTE_SYM() with
constraints in extended assembly parses the "value" as
signed 32-bit integers. An unsigned 32-bit integer with
MSB set results in a negative number in the final binary.
This also prevents integers larger than 32-bit. So this
new macro simply puts the value inline within the assembly
instrcution instead of having it as parameter.

Fixes #31562

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-02-02 09:23:45 -05:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Sebastian Bøe ea7babba13 cmake: Rename CMake variable out of the reserved CONFIG_ namespace
Rename the poorly named CMake variable 'CONFIG_LIST' to
'LIST_OF_CONFIGS' to take it out of the Kconfig-reserved namespace
'CONFIG_*'.

This is a small step towards resolving #12144

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-03-03 23:52:29 -05:00
Sebastian Bøe 777e0a1b86 cmake: Support UTF-8 characters in Kconfig values
We are using the CMake command 'file(STRINGS' (which defaults to only
decoding ASCII) to read Kconfig configurations. When UTF-8 characters
are detected they are treated as newlines.

This behaviour has caused issues when users have input UTF-8
characters into Kconfig values. E.g. USB device descriptor strings.

This commit adds the flag 'ENCODING "UTF-8"' to the 'file(STRINGS'
command so that UTF-8 characters are correctly passed through the
build system.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-03-21 19:11:19 -04:00
Sebastian Bøe 64f858874d cmake: Minor refactor
Minor refactor of build script for readability and diff-ability.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-03-21 19:11:19 -04:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00