-
Notifications
You must be signed in to change notification settings - Fork 95
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
Cmake cleanup: stage1 #247
base: master
Are you sure you want to change the base?
Conversation
One thing I noticed was that I intended that we should put the definitions of However I also realized now that |
Also just redefinig the |
we could also have a separate |
The |
+1 |
That makes sense to me in case it reduces the built object files. |
Makes sense - I'll open a separate request for this. |
80d1276
to
7c36a20
Compare
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
==========================================
- Coverage 41.66% 41.44% -0.22%
==========================================
Files 96 94 -2
Lines 5439 5407 -32
==========================================
- Hits 2266 2241 -25
+ Misses 3173 3166 -7
Continue to review full report at Codecov.
|
7c36a20
to
635cf8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good to me. Remember that we must double check that the usb descriptors stay the same and that the btconly firmware doesn't have any u2f/eth symbols in it.
src/CMakeLists.txt
Outdated
target_link_libraries(${elf} PRIVATE c asf4-drivers-min -Wl,-u,exception_table) | ||
add_dependencies(${elf} libwally-core) | ||
add_dependencies(${elf} noise-c) | ||
target_link_libraries(${elf} PRIVATE c asf4-drivers-min noiseprotocol -Wl,-u,exception_table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think noise and libwally shouldn't be needed in the bootloader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. There was a missing dependency between libwally.a
and libwally-core
(the target actually building libwally!), so the dep tree was broken.
src/CMakeLists.txt
Outdated
target_sources(${elf} PRIVATE ${BITBOX02-FIRMWARE-SOURCES}) | ||
else() | ||
target_sources(${elf} PRIVATE ${BITBOXBASE-FIRMWARE-SOURCES}) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this pattern (find string in elf name) works well here. It works well for the "semhosting" string because it is binary. I think it would be better if you created two variables: "FIRMWARES-BITBOX02" and "FIRMWARE-BITBOXBASE" a bit like there is for the bootloaders. Then you could iterate only over the bb02 firmwares or the bbb firmwares and add sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
8ae0f80
to
b20204b
Compare
b20204b
to
a9710c9
Compare
src/touch/gestures_bitboxbase.c
Outdated
@@ -0,0 +1,385 @@ | |||
// Copyright 2019 Shift Cryptosecurity AG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is nowhere to be found in cmakelists.txt, how does that work?
src/touch/gestures_bitboxbase.c
Outdated
#endif | ||
|
||
#include "gestures.h" | ||
#if PLATFORM_BITBOXBASE == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this redundant? hopefully this file would only be compiled for bitboxbase only.
@@ -25,6 +25,10 @@ | |||
#endif | |||
|
|||
#include "gestures.h" | |||
#include "gestures_impl.h" | |||
#if PLATFORM_BITBOXBASE == 1 | |||
#include "gestures_bitboxbase.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference to gestures_bitboxbase.c?
As the files related to APP_BTC don't depend on any PRODUCT* macro, but only on the APP_* macros, move those to a separate CMake unit (app_btc-multi, app_btc-btc), to avoid multiple unnecessary compilations.
Most of the workflow, components, and UI code doesn't depend on the platform it will be run on. Compile it only once to save many CMake build entries. The gestures code is a dependency of most components, but it has a slight dependency on the hardware platform. Split it into an API and an implementation file to let including the header possible without having to define the platform the code will run on.
a9710c9
to
c6b3b40
Compare
Trying to recover from the multitude of added compilations that the BitBoxBase firmware introduced. This PR adds modularization to the code, and tries to bulid with as little
PRODUCT_*
,APP_*
etc. definitions as possible. In order to make sure that nothing breaks whenundef
ining those macros, they are enforced to be#define
d in the relevant headers (so if a code unit doesn't really need the macro, it won't be able to include the headers that depend on it).