mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
unix: emulator debug build options
This commit is contained in:
parent
84b53e5813
commit
32fe5d20af
@ -246,11 +246,19 @@ env.Replace(
|
||||
STRIP='strip',
|
||||
OBJCOPY='objcopy', )
|
||||
|
||||
if env.get('ENV').get('DEBUG_BUILD', 0):
|
||||
import platform
|
||||
platsys = platform.system()
|
||||
env.Replace(
|
||||
OPTIMIZE='-O0',
|
||||
LINKFLAGS='-Wl,-no_pie' if platsys == "Darwin" else '-Wl,-no-pie'
|
||||
)
|
||||
|
||||
env.Replace(
|
||||
TREZOR_MODEL=env.get('ENV').get('TREZOR_MODEL', 'T'), )
|
||||
|
||||
env.Replace(
|
||||
COPT=env.get('ENV').get('OPTIMIZE', '-Os'),
|
||||
COPT=env.get('OPTIMIZE', env.get('ENV').get('OPTIMIZE', '-Os')),
|
||||
CCFLAGS='$COPT '
|
||||
'-g3 '
|
||||
'-std=gnu99 -Wall -Werror -Wuninitialized '
|
||||
|
@ -98,3 +98,15 @@ Use `make upload` to upload the firmware to a production device (with a bootload
|
||||
For flashing firmware to blank device (without bootloader) use `make flash`,
|
||||
or `make flash STLINK_VER=v2-1` if using a ST-LINK/V2.1 interface.
|
||||
You need to have OpenOCD installed.
|
||||
|
||||
|
||||
## Building for debugging and hacking in Emulator (Unix port)
|
||||
|
||||
Build the debuggable unix binary so you can attach the gdb or lldb.
|
||||
This removes optimizations and reduces address space randomizaiton.
|
||||
Beware that this will significantly bloat the final binary
|
||||
and the firmware runtime memory limit HEAPSIZE may have to be increased.
|
||||
|
||||
```sh
|
||||
DEBUG_BUILD=1 make build_unix
|
||||
```
|
||||
|
@ -32,8 +32,8 @@ void touch_power_off(void);
|
||||
uint32_t touch_read(void);
|
||||
uint32_t touch_click(void);
|
||||
uint32_t touch_is_detected(void);
|
||||
inline uint16_t touch_unpack_x(uint32_t evt) { return (evt >> 12) & 0xFFF; }
|
||||
inline uint16_t touch_unpack_y(uint32_t evt) { return (evt >> 0) & 0xFFF; }
|
||||
inline uint32_t touch_pack_xy(uint16_t x, uint16_t y) { return ((x & 0xFFF) << 12) | (y & 0xFFF); }
|
||||
static inline uint16_t touch_unpack_x(uint32_t evt) { return (evt >> 12) & 0xFFF; }
|
||||
static inline uint16_t touch_unpack_y(uint32_t evt) { return (evt >> 0) & 0xFFF; }
|
||||
static inline uint32_t touch_pack_xy(uint16_t x, uint16_t y) { return ((x & 0xFFF) << 12) | (y & 0xFFF); }
|
||||
|
||||
#endif
|
||||
|
9
emu.sh
9
emu.sh
@ -4,9 +4,9 @@ source emu.config 2>/dev/null
|
||||
|
||||
EXE=build/unix/micropython
|
||||
PYOPT="${PYOPT:-1}"
|
||||
MAIN="${MAIN:-main.py}"
|
||||
MAIN="${MAIN:-${PWD}/src/main.py}"
|
||||
BROWSER="${BROWSER:-chromium}"
|
||||
HEAPSIZE="${HEAPSIZE:-800K}"
|
||||
HEAPSIZE="${HEAPSIZE:-50M}"
|
||||
SOURCE_PY_DIR="${SOURCE_PY_DIR:-src}"
|
||||
|
||||
ARGS="-O${PYOPT} -X heapsize=${HEAPSIZE}"
|
||||
@ -16,7 +16,12 @@ cd `dirname $0`/$SOURCE_PY_DIR
|
||||
case "$1" in
|
||||
"-d")
|
||||
shift
|
||||
OPERATING_SYSTEM=$(uname)
|
||||
if [ $OPERATING_SYSTEM == "Darwin" ]; then
|
||||
PATH=/usr/bin /usr/bin/lldb -f ../$EXE -- $ARGS $* $MAIN
|
||||
else
|
||||
gdb --args ../$EXE $ARGS $* $MAIN
|
||||
fi
|
||||
;;
|
||||
"-r")
|
||||
shift
|
||||
|
Loading…
Reference in New Issue
Block a user