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

Cmake cleanup: stage1 #247

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ set_property(TARGET wallycore
PROPERTY IMPORTED_LOCATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libwallycore.a)
set_target_properties(wallycore PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/libwally-core/include)
set_target_properties(wallycore PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/libwally-core/include)
add_dependencies(wallycore libwally-core)

add_library(secp256k1 STATIC IMPORTED GLOBAL)
set_property(TARGET secp256k1
PROPERTY IMPORTED_LOCATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libsecp256k1.a)
set_target_properties(secp256k1 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/libwally-core/src/secp256k1/include)
set_target_properties(secp256k1 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/libwally-core/src/secp256k1/include)
add_dependencies(secp256k1 libwally-core)


if(CMAKE_CROSSCOMPILING)
Expand Down
254 changes: 183 additions & 71 deletions src/CMakeLists.txt

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions src/apps/btc/btc_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static void _sha256(const uint8_t* bytes, size_t bytes_len, uint8_t* out)
sha256_finish(&ctx, out);
}

static void _reset(void)
void btc_sign_reset(void)
{
_state = STATE_INIT;
_coin_params = NULL;
Expand All @@ -102,7 +102,7 @@ static void _reset(void)

static app_btc_sign_error_t _error(app_btc_sign_error_t err)
{
_reset();
btc_sign_reset();
return err;
}

Expand Down Expand Up @@ -164,7 +164,7 @@ app_btc_sign_error_t app_btc_sign_init(
default:
return _error(APP_BTC_SIGN_ERR_INVALID_INPUT);
}
_reset();
btc_sign_reset();
_coin_params = coin_params;
_init_request = *request;
// Want input #0
Expand Down Expand Up @@ -362,7 +362,7 @@ static app_btc_sign_error_t _sign_input_pass2(
next_out->index = _index;
} else {
// Done with inputs pass2 -> done completely.
_reset();
btc_sign_reset();
next_out->type = BTCSignNextResponse_Type_DONE;
}
return APP_BTC_SIGN_OK;
Expand Down Expand Up @@ -592,10 +592,3 @@ app_btc_sign_error_t app_btc_sign_output(
}
return APP_BTC_SIGN_OK;
}

#ifdef TESTING
void tst_app_btc_reset(void)
{
_reset();
}
#endif
4 changes: 1 addition & 3 deletions src/apps/btc/btc_sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ app_btc_sign_input(const BTCSignInputRequest* request, BTCSignNextResponse* next
USE_RESULT app_btc_sign_error_t
app_btc_sign_output(const BTCSignOutputRequest* request, BTCSignNextResponse* next_out);

#ifdef TESTING
void tst_app_btc_reset(void);
#endif
void btc_sign_reset(void);

#endif
1 change: 1 addition & 0 deletions src/bitboxbase/bitboxbase_background.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <ui/components/image.h>
#include <ui/components/label.h>
#include <ui/components/ui_images.h>
#include <ui/components/ui_logos.h>
#include <ui/event.h>
#include <ui/oled/oled.h>
#include <ui/screen_stack.h>
Expand Down
1 change: 1 addition & 0 deletions src/bootloader/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <pukcc/curve_p256.h>
#include <screen.h>
#include <ui/components/ui_images.h>
#include <ui/components/ui_logos.h>
#include <ui/oled/oled.h>
#include <ui/ugui/ugui.h>
#if PLATFORM_BITBOXBASE == 1
Expand Down
1 change: 1 addition & 0 deletions src/commander/commander.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <hardfault.h>
#include <keystore.h>
#include <memory/memory.h>
#include <platform_config.h>
#include <random.h>
#include <screen.h>
#include <sd.h>
Expand Down
1 change: 1 addition & 0 deletions src/hww.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <usb/noise.h>
#include <usb/usb_packet.h>
#include <usb/usb_processing.h>
#include <version.h>
#include <workflow/status.h>
#include <workflow/unlock.h>

Expand Down
6 changes: 6 additions & 0 deletions src/qtouch/qtouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Copyright (c) 2017 Microchip. All rights reserved.
#include <driver_init.h>
#include <platform_config.h>

#if PLATFORM_BITBOXBASE == 1
#include "qtouch_bitboxbase.h"
#else
#include "qtouch_bitbox02.h"
#endif

/*----------------------------------------------------------------------------
* prototypes
*----------------------------------------------------------------------------*/
Expand Down
216 changes: 0 additions & 216 deletions src/qtouch/qtouch.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ extern "C" {
*----------------------------------------------------------------------------*/

#include "touch_api_ptc.h"
#include <platform_config.h>

#if PLATFORM_BITBOXBASE == 1
bool qtouch_get_button_state(size_t idx);
#endif

/**********************************************************/
/******************* Acquisition controls *****************/
Expand Down Expand Up @@ -76,206 +71,6 @@ bool qtouch_get_button_state(size_t idx);
* defines
*----------------------------------------------------------------------------*/

#if PLATFORM_BITBOX02 == 1
/**********************************************************/
/***************** Node Params ******************/
/**********************************************************/
/* Acquisition Set 1 */
/* Defines the number of sensor nodes in the acquisition set
* Range: 1 to 65535.
* Default value: 1
*/
#define DEF_NUM_CHANNELS (8)

/* Defines node parameter setting
* {X-line, Y-line, Charge Share Delay, NODE_RSEL_PRSC(series resistor, prescaler), NODE_G(Analog
* Gain , Digital Gain), filter level}
*/
// Slider 1 buttons
#define NODE_0_PARAMS \
{ \
X_NONE, Y_LINE(26), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_1_PARAMS \
{ \
X_NONE, Y_LINE(27), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_2_PARAMS \
{ \
X_NONE, Y_LINE(28), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_3_PARAMS \
{ \
X_NONE, Y_LINE(29), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
// Slider 0 buttons
#define NODE_4_PARAMS \
{ \
X_NONE, Y_LINE(30), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_5_PARAMS \
{ \
X_NONE, Y_LINE(31), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_6_PARAMS \
{ \
X_NONE, Y_LINE(20), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}
#define NODE_7_PARAMS \
{ \
X_NONE, Y_LINE(21), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_1), \
NODE_GAIN(GAIN_4, GAIN_4), FILTER_LEVEL_512 \
}

/**********************************************************/
/***************** Key Params ******************/
/**********************************************************/
/* Defines the number of key sensors
* Range: 1 to 65535.
* Default value: 1
*/
#define DEF_NUM_SENSORS (DEF_NUM_CHANNELS)

/* Defines Key Sensor setting
* {Sensor Threshold, Sensor Hysterisis, Sensor AKS}
*/
// 0..3 higher Slider left to right 4..7 lower Slider right to left
#define KEY_0_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_1_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_2_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_3_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_4_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_5_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_6_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_7_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}

#elif PLATFORM_BITBOXBASE == 1
/**********************************************************/
/***************** Node Params ******************/
/**********************************************************/
/* Acquisition Set 1 */
/* Defines the number of sensor nodes in the acquisition set
* Range: 1 to 65535.
* Default value: 1
*/
#define DEF_NUM_CHANNELS (6)

/* Defines node parameter setting
* {X-line, Y-line, Charge Share Delay, NODE_RSEL_PRSC(series resistor, prescaler), NODE_G(Analog
* Gain , Digital Gain), filter level}
*/
// Slider buttons
#define NODE_0_PARAMS \
{ \
X_NONE, Y_LINE(23), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_2), \
NODE_GAIN(GAIN_8, GAIN_1), FILTER_LEVEL_32 \
}
#define NODE_1_PARAMS \
{ \
X_NONE, Y_LINE(22), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_2), \
NODE_GAIN(GAIN_8, GAIN_1), FILTER_LEVEL_32 \
}
#define NODE_2_PARAMS \
{ \
X_NONE, Y_LINE(21), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_2), \
NODE_GAIN(GAIN_8, GAIN_1), FILTER_LEVEL_32 \
}
#define NODE_3_PARAMS \
{ \
X_NONE, Y_LINE(20), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_2), \
NODE_GAIN(GAIN_8, GAIN_1), FILTER_LEVEL_32 \
}
// Top buttons
#define NODE_4_PARAMS \
{ \
X_NONE, Y_LINE(30), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_4), \
NODE_GAIN(GAIN_16, GAIN_2), FILTER_LEVEL_256 \
}
#define NODE_5_PARAMS \
{ \
X_NONE, Y_LINE(31), 0, NODE_RSEL_PRSC(RSEL_VAL_20, PRSC_DIV_SEL_4), \
NODE_GAIN(GAIN_16, GAIN_2), FILTER_LEVEL_256 \
}

/**********************************************************/
/***************** Key Params ******************/
/**********************************************************/
/* Defines the number of key sensors
* Range: 1 to 65535.
* Default value: 1
*/
#define DEF_NUM_SENSORS (DEF_NUM_CHANNELS)

/* Defines Key Sensor setting
* {Sensor Threshold, Sensor Hysterisis, Sensor AKS}
*/
// 0..3 higher Slider left to right 4..7 lower Slider right to left
#define KEY_0_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_1_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_2_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_3_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_4_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}
#define KEY_5_PARAMS \
{ \
16, HYST_50, NO_AKS_GROUP \
}

/*
* Defines number of buttson
*/
#define DEF_NUM_BUTTONS 2
/*
* Defines the offset to the first button in the node list
*/
#define DEF_BUTTON_OFFSET 4
#endif

/* De-bounce counter for additional measurements to confirm touch detection
* Range: 0 to 255.
* Default value: 4.
Expand Down Expand Up @@ -347,17 +142,6 @@ bool qtouch_get_button_state(size_t idx);
* This allows low noise button readings while keeping
* fast responsiveness.
*/
#if PLATFORM_BITBOX02 == 1
#define DEF_NUM_SCROLLERS 2 // Number of scrollers (sliders or wheels)
#define DEF_SCROLLER_NUM_CHANNELS 4 // Number of channels per scroller
#define DEF_SCROLLER_OFFSET_0 4 // Index of first button in scroller
#define DEF_SCROLLER_OFFSET_1 0 // Index of first button in scroller
#elif PLATFORM_BITBOXBASE == 1
#define DEF_NUM_SCROLLERS 1 // Number of scrollers (sliders or wheels)
#define DEF_SCROLLER_NUM_CHANNELS 4 // Number of channels per scroller
#define DEF_SCROLLER_OFFSET_0 0 // Index of first button in scroller
#define DEF_SCROLLER_OFFSET_1 0 // Index of first button in scroller
#endif
#define DEF_SCROLLER_RESOLUTION 256 // Scroller resolution in bits
#define DEF_SCROLLER_DET_THRESHOLD 25 // Scroller detect threshold
#define DEF_SCROLLER_TOUCH_THRESHOLD 25 // Scroller active threshold
Expand Down
Loading