Skip to content

Commit

Permalink
ci build fix (#14)
Browse files Browse the repository at this point in the history
Signed-off-by: Adam BZH <adam@onekey.so>
  • Loading branch information
424778940z authored Jan 30, 2024
1 parent ec12d21 commit b7c405d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 6 deletions.
58 changes: 57 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,65 @@ set(
set(NRF_SDK_LINK
${NRF_SDK_ROOT}/external/nrf_cc310/lib/cortex-m4/hard-float/libnrf_cc310_0.9.12.a
${NRF_SDK_ROOT}/external/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.1.a
${NRF_SDK_ROOT}/external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a
# ${NRF_SDK_ROOT}/external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a
# ${NRF_SDK_ROOT}/components/nfc/t4t_lib/nfc_t4t_lib_gcc.a
)

###############################
# micro-ecc

set(MicroECC_DIR ${NRF_SDK_ROOT}/external/micro-ecc)

add_library(
MicroECC STATIC
${MicroECC_DIR}/micro-ecc/uECC.c
)

target_include_directories(
MicroECC PUBLIC
${MicroECC_DIR}/micro-ecc
${NRF_SDK_ROOT}/components/toolchain/cmsis/include
)

target_compile_options(
MicroECC PRIVATE
# Optimization flags
-Os -g3
# Uncomment the line below to enable link time optimization
# -flto
# C flags common to all targets
-DFLOAT_ABI_HARD
-DuECC_ENABLE_VLI_API=0
-DuECC_OPTIMIZATION_LEVEL=3
-DuECC_SQUARE_FUNC=0
-DuECC_SUPPORT_COMPRESSED_POINT=0
-DuECC_VLI_NATIVE_LITTLE_ENDIAN=1
-mcpu=cortex-m4
-mthumb -mabi=aapcs
# -Wall -Werror
-Wall -Werror
-mfloat-abi=hard -mfpu=fpv4-sp-d16
# keep every function in a separate section, this allows linker to discard unused ones
-ffunction-sections -fdata-sections -fno-strict-aliasing
-fno-builtin -fshort-enums -Wno-unused-function
# heap and stack
-D__HEAP_SIZE=4096
-D__STACK_SIZE=4096
)

target_link_options(
MicroECC PRIVATE
# Linker flags
-Os -g3
-mthumb -mabi=aapcs -L${NRF_SDK_ROOT}/modules/nrfx/mdk -T${MicroECC_DIR}/nrf52hf_armgcc/armgcc/ext_micro_ecc_gcc_nRF5x.ld
-mcpu=cortex-m4
-mfloat-abi=hard -mfpu=fpv4-sp-d16
# let linker dump unused sections
-Wl,--gc-sections
# use newlib in nano version
-lc -lnosys -lm
)

###############################
# Target

Expand Down Expand Up @@ -402,6 +457,7 @@ target_link_options(
target_link_libraries(
${CMAKE_PROJECT_NAME} PRIVATE
${NRF_SDK_LINK}
MicroECC
)

###############################
Expand Down
12 changes: 7 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#!/bin/sh

set -e

##### KEY #####
export BT_SIG_PK_FILE=$(pwd)/temp.pk
echo "$BT_SIG_PK" > $BT_SIG_PK_FILE

##### CLEANUP #####
rm -r artifacts 2> /dev/null
rm -r artifacts_signed 2> /dev/null
rm -rf artifacts
rm -rf artifacts_signed

##### BUILD #####
# remove build folder if exists
rm -r _build 2> /dev/null
rm -rf _build
# build
mkdir -p _build
cmake -G 'Ninja' -S ./ -B ./_build
cmake --build ./_build --config Release -- -j$(nproc)
# remove build folder
rm $BT_SIG_PK_FILE
rm -r _build
rm -f $BT_SIG_PK_FILE
rm -rf _build

0 comments on commit b7c405d

Please sign in to comment.