Skip to content
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

parameters metadata generate as single static constexpr header #11318

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions boards/airmind/mindpx-v2/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
} > flash
Expand Down
8 changes: 0 additions & 8 deletions boards/auav/esc35-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/auav/x21/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/av/x-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
4 changes: 4 additions & 0 deletions boards/bitcraze/crazyflie/default.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# workaround for syslink parameter
# PARAM_DEFINE_INT32(SLNK_RADIO_ADDR2, 3890735079); // 0xE7E7E7E7
add_compile_options(-Wno-narrowing)

px4_add_board(
PLATFORM nuttx
VENDOR bitcraze
Expand Down
8 changes: 0 additions & 8 deletions boards/bitcraze/crazyflie/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
9 changes: 0 additions & 9 deletions boards/holybro/kakutef7/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
} > flash
Expand Down
8 changes: 0 additions & 8 deletions boards/intel/aerofc-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
9 changes: 0 additions & 9 deletions boards/mro/ctrl-zero-f7/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
} > flash
Expand Down
12 changes: 0 additions & 12 deletions boards/nxp/fmuk66-v3/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,6 @@ SECTIONS
. += 8;
} > progflash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
. = ALIGN(8);
FILL(0xff)
. += 8;
} > progflash

.ARM.extab : {
*(.ARM.extab*)
. = ALIGN(8);
Expand Down
8 changes: 0 additions & 8 deletions boards/omnibus/f4sd/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/cannode-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/esc-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/fmu-v2/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/fmu-v3/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/fmu-v4/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/fmu-v4pro/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
8 changes: 0 additions & 8 deletions boards/px4/fmu-v5/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
9 changes: 0 additions & 9 deletions boards/px4/fmu-v5x/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
} > flash
Expand Down
8 changes: 0 additions & 8 deletions boards/thiemar/s2740vc-v1/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
Expand Down
9 changes: 0 additions & 9 deletions boards/uvify/core/nuttx-config/scripts/script.ld
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ SECTIONS
_einit = ABSOLUTE(.);
} > flash

/*
* Construction data for parameters.
*/
__param ALIGN(4): {
__param_start = ABSOLUTE(.);
KEEP(*(__param*))
__param_end = ABSOLUTE(.);
} > flash

.ARM.extab : {
*(.ARM.extab*)
} > flash
Expand Down
2 changes: 2 additions & 0 deletions platforms/posix/cmake/sitl_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

# TODO: find a way to keep this in sync with tests_main
set(tests
atomic_bitset
autodeclination
bezier
bitset
bson
commander
controllib
Expand Down
12 changes: 4 additions & 8 deletions src/lib/parameters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,14 @@ add_custom_command(OUTPUT ${parameters_xml}
)
add_custom_target(parameters_xml DEPENDS ${parameters_xml})

# generate px4_parameters.c and px4_parameters{,_public}.h
add_custom_command(OUTPUT px4_parameters.c px4_parameters.h px4_parameters_public.h
# generate px4_parameters.hpp
add_custom_command(OUTPUT px4_parameters.hpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_generate_params.py
--xml ${parameters_xml} --dest ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${PX4_BINARY_DIR}/parameters.xml
px_generate_params.py
templates/px4_parameters.c.jinja
templates/px4_parameters.h.jinja
templates/px4_parameters_public.h.jinja
templates/px4_parameters.hpp.jinja
)

set(SRCS)
Expand All @@ -138,9 +136,7 @@ endif()
if (NOT "${PX4_BOARD}" MATCHES "px4_io")
add_library(parameters
${SRCS}
px4_parameters.c
px4_parameters.h
px4_parameters_public.h
px4_parameters.hpp
)

if ("${CONFIG_SHMEM}" STREQUAL "1")
Expand Down
20 changes: 1 addition & 19 deletions src/lib/parameters/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,25 +447,7 @@ union param_value_u {
* instead.
*/
struct param_info_s {
const char *name

// GCC 4.8 and higher don't implement proper alignment of static data on
// 64-bit. This means that the 24-byte param_info_s variables are
// 16 byte aligned by GCC and that messes up the assumption that
// sequential items in the __param segment can be addressed as an array.
// The assumption is that the address of the second parameter is at
// &param[0]+sizeof(param[0]). When compiled with clang it is
// true, with gcc is is not true.
// See https://llvm.org/bugs/show_bug.cgi?format=multiple&id=18006
// The following hack is for GCC >=4.8 only. Clang works fine without
// this.
#ifdef __PX4_POSIX
__attribute__((aligned(16)));
#else
;
#endif
param_type_t type;
uint16_t volatile_param: 1;
const char *name;
union param_value_u val;
};

Expand Down
Loading