Skip to content

Commit bf34ef8

Browse files
Revert "feat: Changing versioning"
This reverts commit b92ed97.
1 parent fe1775f commit bf34ef8

File tree

3 files changed

+24
-46
lines changed

3 files changed

+24
-46
lines changed

CMakeLists.txt

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,37 @@ set(CMAKE_MESSAGE_LOG_LEVEL debug)
44
if("${CMAKE_BUILD_PLATFORM}" STREQUAL "Device")
55
message("Device platform selected")
66
set(CMAKE_TOOLCHAIN_FILE utilities/cmake/arm-none-eabi-gcc.cmake)
7-
set(PROJECT_NAME_BASE Cypherock-${FIRMWARE_TYPE})
7+
set(PROJECT Cypherock-${FIRMWARE_TYPE})
88
elseif("${CMAKE_BUILD_PLATFORM}" STREQUAL "Simulator")
99
message("Simulator platform selected")
10-
set(PROJECT_NAME_BASE Cypherock_Simulator)
10+
set(PROJECT Cypherock_Simulator)
1111
else()
12-
message(WARNING "No platform specified, defaulting to Simulator. Specify using -DCMAKE_BUILD_PLATFORM=<Type>")
13-
set(PROJECT_NAME_BASE Cypherock_Simulator)
12+
message(WARNING "No platform specified defaulting to Simulator. Specify using -DCMAKE_BUILD_PLATFORM=<Type> Type can be Device or Simulator")
13+
set(PROJECT Cypherock_Simulator)
1414
endif()
1515

16-
# Define all build options
16+
# Define all options upfront, including BTC_ONLY
1717
OPTION(DEV_SWITCH "Additional features/logs to aid developers" OFF)
1818
OPTION(UNIT_TESTS_SWITCH "Compile build for main firmware or unit tests" OFF)
1919
OPTION(BTC_ONLY "Build firmware for Bitcoin only" OFF)
2020

21-
# Append suffix to the project name if BTC_ONLY is enabled
22-
set(PROJECT ${PROJECT_NAME_BASE})
21+
# Logic to append -btc to project name if BTC_ONLY is enabled
2322
if (BTC_ONLY)
2423
set(PROJECT ${PROJECT}-btc)
2524
endif()
2625

27-
# Define the project with its final calculated name
28-
project(${PROJECT})
29-
3026
# Make static functions testable via unit-tests
3127
IF(UNIT_TESTS_SWITCH)
3228
add_compile_definitions( STATIC= )
3329
ELSE()
3430
add_compile_definitions( STATIC=static )
3531
ENDIF(UNIT_TESTS_SWITCH)
3632

37-
# Set firmware type (Main or Initial)
38-
if ("${FIRMWARE_TYPE}" STREQUAL "Main")
39-
add_compile_definitions(X1WALLET_INITIAL=0 X1WALLET_MAIN=1)
40-
elseif("${FIRMWARE_TYPE}" STREQUAL "Initial")
41-
add_compile_definitions(X1WALLET_INITIAL=1 X1WALLET_MAIN=0)
42-
endif()
43-
44-
# Set variant-specific definition (BTC_ONLY_BUILD)
45-
if(BTC_ONLY)
46-
add_compile_definitions(BTC_ONLY_BUILD=1)
47-
endif()
48-
49-
# Set hash calculation definition based on build type
50-
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
51-
add_compile_definitions(FIRMWARE_HASH_CALC=1)
52-
else()
53-
add_compile_definitions(FIRMWARE_HASH_CALC=0)
54-
endif()
55-
56-
# Enable support for dynamically allocated fields in nanopb
57-
add_compile_definitions(PB_ENABLE_MALLOC=1 PB_NO_ERRMSG=1)
33+
# Now define the project with its final name, after all modifications
34+
project(${PROJECT})
5835

36+
# python is needed for compiling proto files using nanopb
37+
# also for generating & appending firmware signature headers
5938
find_package( Python3 REQUIRED COMPONENTS Interpreter )
6039

6140
# Conditionally generate protobuf files based on the BTC_ONLY option
@@ -95,17 +74,26 @@ list (APPEND POSEIDON_SRCS
9574
"vendor/poseidon/sources/poseidon_rc.c"
9675
)
9776

98-
# This is where add_executable(${PROJECT} ...) is called
77+
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
78+
add_compile_definitions(FIRMWARE_HASH_CALC=1)
79+
else()
80+
add_compile_definitions(FIRMWARE_HASH_CALC=0)
81+
endif()
82+
9983
if("${CMAKE_BUILD_PLATFORM}" STREQUAL "Device")
10084
include(utilities/cmake/firmware/firmware.cmake)
10185
else() # Simulator or default
10286
include(utilities/cmake/simulator/simulator.cmake)
10387
endif()
10488

105-
# This must come AFTER the add_executable call in the included files
106-
target_include_directories( ${PROJECT} PRIVATE
89+
# Include nanopb source headers
90+
target_include_directories( ${EXECUTABLE} PRIVATE
10791
vendor/nanopb
10892
generated/proto
10993
vendor/mini-gmp
11094
vendor/poseidon/sources
111-
)
95+
)
96+
97+
# Enable support for dynamically allocated fields in nanopb
98+
# Ref: vendor/nanopb/pb.h
99+
add_compile_definitions(PB_ENABLE_MALLOC=1 PB_NO_ERRMSG=1)

apps/manager_app/get_device_info.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
#include "manager_api.h"
6868
#include "manager_app.h"
6969
#include "onboarding.h"
70-
#include <string.h>
7170

7271
/*****************************************************************************
7372
* EXTERN VARIABLES
@@ -144,15 +143,6 @@ static manager_get_device_info_response_t get_device_info(void) {
144143
result->is_initial =
145144
(MANAGER_ONBOARDING_STEP_COMPLETE != onboarding_get_last_step());
146145
result->onboarding_step = onboarding_get_last_step();
147-
148-
// Populate the firmware variant string based on the compile-time flag.
149-
// This allows the client (CySync) to know which firmware variant is running.
150-
#ifdef BTC_ONLY_BUILD
151-
strcpy(result->variant, "BTC_ONLY");
152-
#else
153-
strcpy(result->variant, "MULTICOIN");
154-
#endif
155-
156146
// TODO: populate applet list (result->applet_list)
157147
}
158148

utilities/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ if [ ! $? -eq 0 ]; then exit 1; fi
158158
if [[ "${clean_flag}" = "true" ]]; then
159159
"${BUILD_TOOL}" clean
160160
fi
161-
"${BUILD_TOOL}" -j8 all
161+
"${BUILD_TOOL}" -j8 all

0 commit comments

Comments
 (0)