mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
debug: Improve debugging API (#134)
* Allow DEBUG_LOG without DEBUG_LINK * Move debugInt() to debug.c
This commit is contained in:
parent
5c00b24307
commit
5f203d0a0c
@ -20,6 +20,7 @@
|
|||||||
#include "trezor.h"
|
#include "trezor.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "oled.h"
|
#include "oled.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#if DEBUG_LOG
|
#if DEBUG_LOG
|
||||||
|
|
||||||
@ -50,4 +51,15 @@ void debugLog(int level, const char *bucket, const char *text)
|
|||||||
oledDebug(text);
|
oledDebug(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *debugInt(const uint32_t i)
|
||||||
|
{
|
||||||
|
static uint8_t n = 0;
|
||||||
|
static char id[8][9];
|
||||||
|
uint32hex(i, id[n]);
|
||||||
|
debugLog(0, "", id[n]);
|
||||||
|
char *ret = (char *)id[n];
|
||||||
|
n = (n + 1) % 8;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,14 +21,17 @@
|
|||||||
#define __DEBUG_H__
|
#define __DEBUG_H__
|
||||||
|
|
||||||
#include "trezor.h"
|
#include "trezor.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#if DEBUG_LOG
|
#if DEBUG_LOG
|
||||||
|
|
||||||
void debugLog(int level, const char *bucket, const char *text);
|
void debugLog(int level, const char *bucket, const char *text);
|
||||||
|
char *debugInt(const uint32_t i);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define debugLog(L, B, T) do{}while(0)
|
#define debugLog(L, B, T) do{}while(0)
|
||||||
|
#define debugInt(I) do{}while(0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -99,8 +99,11 @@ int main(void)
|
|||||||
|
|
||||||
timer_init();
|
timer_init();
|
||||||
|
|
||||||
#if DEBUG_LINK
|
#if DEBUG_LOG
|
||||||
oledSetDebug(1);
|
oledSetDebug(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEBUG_LINK
|
||||||
storage_reset(); // wipe storage if debug link
|
storage_reset(); // wipe storage if debug link
|
||||||
storage_reset_uuid();
|
storage_reset_uuid();
|
||||||
storage_commit();
|
storage_commit();
|
||||||
|
@ -92,22 +92,6 @@ typedef struct {
|
|||||||
uint8_t chal[U2F_CHAL_SIZE];
|
uint8_t chal[U2F_CHAL_SIZE];
|
||||||
} U2F_AUTHENTICATE_SIG_STR;
|
} U2F_AUTHENTICATE_SIG_STR;
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG_LOG
|
|
||||||
char *debugInt(const uint32_t i)
|
|
||||||
{
|
|
||||||
static uint8_t n = 0;
|
|
||||||
static char id[8][9];
|
|
||||||
uint32hex(i, id[n]);
|
|
||||||
debugLog(0, "", id[n]);
|
|
||||||
char *ret = (char *)id[n];
|
|
||||||
n = (n + 1) % 8;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define debugInt(I) do{}while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static uint32_t dialog_timeout = 0;
|
static uint32_t dialog_timeout = 0;
|
||||||
|
|
||||||
uint32_t next_cid(void)
|
uint32_t next_cid(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user