mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
board_identity: move to platforms/nuttx/src
And fix a potential alignment issue in board_get_mfguid and board_get_px4_guid.
This commit is contained in:
@@ -32,5 +32,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
empty.c
|
||||||
)
|
)
|
||||||
|
|||||||
0
boards/aerotenna/ocpoc/src/empty.c
Normal file
0
boards/aerotenna/ocpoc/src/empty.c
Normal file
@@ -32,6 +32,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
|
||||||
sitl_led.c
|
sitl_led.c
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -35,6 +35,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")
|
|||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
init.c
|
init.c
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -32,5 +32,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
empty.c
|
||||||
)
|
)
|
||||||
|
|||||||
0
boards/emlid/navio2/src/empty.c
Normal file
0
boards/emlid/navio2/src/empty.c
Normal file
@@ -32,5 +32,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
empty.c
|
||||||
)
|
)
|
||||||
|
|||||||
0
boards/parrot/bebop/src/empty.c
Normal file
0
boards/parrot/bebop/src/empty.c
Normal file
@@ -32,5 +32,5 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
empty.c
|
||||||
)
|
)
|
||||||
|
|||||||
0
boards/px4/raspberrypi/src/empty.c
Normal file
0
boards/px4/raspberrypi/src/empty.c
Normal file
@@ -32,7 +32,6 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_board
|
add_library(drivers_board
|
||||||
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
|
|
||||||
sitl_led.c
|
sitl_led.c
|
||||||
sitl_board_shutdown.c
|
sitl_board_shutdown.c
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ if (NOT "${PX4_PLATFORM}" MATCHES "qurt" AND NOT "${PX4_BOARD}" MATCHES "io-v2")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(px4_platform
|
add_library(px4_platform
|
||||||
|
board_identity.c
|
||||||
module.cpp
|
module.cpp
|
||||||
px4_getopt.c
|
px4_getopt.c
|
||||||
px4_cli.cpp
|
px4_cli.cpp
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ if (NOT ${PX4_BOARD} MATCHES "px4_io")
|
|||||||
)
|
)
|
||||||
target_link_libraries(px4_layer
|
target_link_libraries(px4_layer
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
arch_version
|
||||||
nuttx_apps # up_cxxinitialize
|
nuttx_apps # up_cxxinitialize
|
||||||
nuttx_sched
|
nuttx_sched
|
||||||
drivers_boards_common_arch
|
drivers_boards_common_arch
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ add_subdirectory(../kinetis/led_pwm led_pwm)
|
|||||||
add_subdirectory(../kinetis/hrt hrt)
|
add_subdirectory(../kinetis/hrt hrt)
|
||||||
add_subdirectory(../kinetis/io_pins io_pins)
|
add_subdirectory(../kinetis/io_pins io_pins)
|
||||||
add_subdirectory(../kinetis/tone_alarm tone_alarm)
|
add_subdirectory(../kinetis/tone_alarm tone_alarm)
|
||||||
|
add_subdirectory(../kinetis/version version)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
37
platforms/nuttx/src/px4/nxp/kinetis/version/CMakeLists.txt
Normal file
37
platforms/nuttx/src/px4/nxp/kinetis/version/CMakeLists.txt
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015-2019 PX4 Development Team. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
px4_add_library(arch_version
|
||||||
|
board_identity.c
|
||||||
|
)
|
||||||
|
|
||||||
@@ -51,12 +51,12 @@ static const uint16_t soc_arch_id = PX4_SOC_ARCH_ID;
|
|||||||
void board_get_uuid(uuid_byte_t uuid_bytes)
|
void board_get_uuid(uuid_byte_t uuid_bytes)
|
||||||
{
|
{
|
||||||
uint32_t *chip_uuid = (uint32_t *) KINETIS_SIM_UIDH;
|
uint32_t *chip_uuid = (uint32_t *) KINETIS_SIM_UIDH;
|
||||||
uint32_t *uuid_words = (uint32_t *) uuid_bytes;
|
uint8_t *uuid_words = uuid_bytes;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
for (unsigned int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
||||||
uint32_t current_uuid_bytes = SWAP_UINT32(chip_uuid[i]);
|
uint32_t current_uuid_bytes = SWAP_UINT32(chip_uuid[i]);
|
||||||
memcpy(uuid_words, ¤t_uuid_bytes, sizeof(uint32_t));
|
memcpy(uuid_words, ¤t_uuid_bytes, sizeof(uint32_t));
|
||||||
++uuid_words;
|
uuid_words += sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015-2019 PX4 Development Team. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
px4_add_library(arch_version
|
||||||
|
board_identity.c
|
||||||
|
)
|
||||||
|
|
||||||
@@ -104,10 +104,12 @@ int board_get_uuid32_formated(char *format_buffer, int size,
|
|||||||
int board_get_mfguid(mfguid_t mfgid)
|
int board_get_mfguid(mfguid_t mfgid)
|
||||||
{
|
{
|
||||||
uint32_t *chip_uuid = (uint32_t *) STM32_SYSMEM_UID;
|
uint32_t *chip_uuid = (uint32_t *) STM32_SYSMEM_UID;
|
||||||
uint32_t *rv = (uint32_t *) &mfgid[0];
|
uint8_t *rv = &mfgid[0];
|
||||||
|
|
||||||
for (unsigned i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
for (unsigned i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
||||||
*rv++ = SWAP_UINT32(chip_uuid[(PX4_CPU_UUID_WORD32_LENGTH - 1) - i]);
|
uint32_t uuid_bytes = SWAP_UINT32(chip_uuid[(PX4_CPU_UUID_WORD32_LENGTH - 1) - i]);
|
||||||
|
memcpy(rv, &uuid_bytes, sizeof(uint32_t));
|
||||||
|
rv += sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PX4_CPU_MFGUID_BYTE_LENGTH;
|
return PX4_CPU_MFGUID_BYTE_LENGTH;
|
||||||
@@ -137,13 +139,12 @@ int board_get_px4_guid(px4_guid_t px4_guid)
|
|||||||
*pb++ = 0;
|
*pb++ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t *rv = (uint32_t *) pb;
|
|
||||||
uint32_t *chip_uuid = (uint32_t *) STM32_SYSMEM_UID;
|
uint32_t *chip_uuid = (uint32_t *) STM32_SYSMEM_UID;
|
||||||
|
|
||||||
for (unsigned i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
for (unsigned i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
|
||||||
uint32_t uuid_bytes = SWAP_UINT32(chip_uuid[(PX4_CPU_UUID_WORD32_LENGTH - 1) - i]);
|
uint32_t uuid_bytes = SWAP_UINT32(chip_uuid[(PX4_CPU_UUID_WORD32_LENGTH - 1) - i]);
|
||||||
memcpy(rv, &uuid_bytes, sizeof(uint32_t));
|
memcpy(pb, &uuid_bytes, sizeof(uint32_t));
|
||||||
++rv;
|
pb += sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PX4_GUID_BYTE_LENGTH;
|
return PX4_GUID_BYTE_LENGTH;
|
||||||
@@ -38,6 +38,7 @@ add_subdirectory(../stm32_common/hrt hrt)
|
|||||||
add_subdirectory(../stm32_common/led_pwm led_pwm)
|
add_subdirectory(../stm32_common/led_pwm led_pwm)
|
||||||
add_subdirectory(../stm32_common/io_pins io_pins)
|
add_subdirectory(../stm32_common/io_pins io_pins)
|
||||||
add_subdirectory(../stm32_common/tone_alarm tone_alarm)
|
add_subdirectory(../stm32_common/tone_alarm tone_alarm)
|
||||||
|
add_subdirectory(../stm32_common/version version)
|
||||||
|
|
||||||
add_subdirectory(px4io_serial)
|
add_subdirectory(px4io_serial)
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ add_subdirectory(../stm32_common/hrt hrt)
|
|||||||
add_subdirectory(../stm32_common/led_pwm led_pwm)
|
add_subdirectory(../stm32_common/led_pwm led_pwm)
|
||||||
add_subdirectory(../stm32_common/io_pins io_pins)
|
add_subdirectory(../stm32_common/io_pins io_pins)
|
||||||
add_subdirectory(../stm32_common/tone_alarm tone_alarm)
|
add_subdirectory(../stm32_common/tone_alarm tone_alarm)
|
||||||
|
add_subdirectory(../stm32_common/version version)
|
||||||
|
|
||||||
add_subdirectory(px4io_serial)
|
add_subdirectory(px4io_serial)
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_boards_common_arch
|
add_library(drivers_boards_common_arch
|
||||||
board_identity.c
|
|
||||||
board_mcu_version.c
|
board_mcu_version.c
|
||||||
board_reset.c
|
board_reset.c
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
add_library(drivers_boards_common_arch
|
add_library(drivers_boards_common_arch
|
||||||
board_identity.c
|
|
||||||
board_mcu_version.c
|
board_mcu_version.c
|
||||||
board_reset.c
|
board_reset.c
|
||||||
board_critmon.c
|
board_critmon.c
|
||||||
|
|||||||
Reference in New Issue
Block a user