mdebug

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5f6f56ca215948d9795f5e24136c8eeadbbbc363
parent 48c7750c473f533520ff38dece6492d408c90a72
Author: Brian Swetland <swetland@frotz.net>
Date:   Wed,  5 Aug 2015 22:37:32 -0700

simplify build system, support build w/out cross-compiler

Diffstat:
MMakefile | 108++++++++++++++++++++++++++++++-------------------------------------------------
Aagents/lpc13xx.c | 5+++++
Magents/lpc13xx_lpc15xx.c | 10+++++-----
Aagents/lpc15xx.c | 7+++++++
Magents/lpc43xx-spifi.c | 8++++----
Aagents/lpclink2.c | 5+++++
Aagents/stm32f4xx.c | 6++++++
Magents/stm32fxxx.c | 18+++++++++---------
Abuild/agent.ld | 32++++++++++++++++++++++++++++++++
Mbuild/build.mk | 119++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
Atools/builtins.c | 123+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools/debugger-commands.c | 2+-
12 files changed, 308 insertions(+), 135 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,84 +1,58 @@ -## Copyright 2011 Brian Swetland <swetland@frotz.net> -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. what_to_build:: all -include local.mk -TOOLCHAIN ?= arm-none-eabi- - -TARGET_CC := $(TOOLCHAIN)gcc -TARGET_LD := $(TOOLCHAIN)ld -TARGET_AR := $(TOOLCHAIN)ar -TARGET_OBJCOPY := $(TOOLCHAIN)objcopy -TARGET_OBJDUMP := $(TOOLCHAIN)objdump - -TARGET_CFLAGS := -g -Os -Wall -TARGET_CFLAGS += -Wno-unused-but-set-variable -TARGET_CFLAGS += -I. -Iinclude -TARGET_CFLAGS += -mcpu=cortex-m3 -mthumb -mthumb-interwork -TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_CFLAGS += -fno-builtin -nostdlib - -# tell gcc there's not a full libc it can depend on -# so it won't do thinks like printf("...") -> puts("...") -TARGET_CFLAGS += -ffreestanding -TARGET_LFLAGS := --gc-sections - -#TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_CFLAGS) -print-libgcc-file-name) - -UNAME := $(shell uname) -UNAME_M := $(shell uname -m) - -HOST_CFLAGS := -g -O1 -Wall -HOST_CFLAGS += -Itools -Iinclude -HOST_CFLAGS += -DLINENOISE_INTERRUPTIBLE +include build/build.mk -ifeq ($(UNAME),Darwin) -HOST_CFLAGS += -I/opt/local/include -L/opt/local/lib -HOST_LIBS += -lusb-1.0 -endif -ifeq ($(UNAME),Linux) -HOST_CFLAGS += -DWITH_THUMB2_DISASSEMBLE=1 -HOST_LIBS += -lusb-1.0 -lpthread -lrt +# bootloader download tool +SRCS := tools/lpcboot.c \ + tools/usb.c +$(call program,lpcboot,$(SRCS)) + +# debugger +SRCS := tools/debugger.c \ + tools/debugger-core.c \ + tools/debugger-commands.c \ + tools/gdb-bridge.c \ + tools/linenoise.c \ + tools/lkdebug.c \ + tools/rswdp.c \ + tools/socket.c \ + tools/swo.c \ + tools/usb.c + +ifneq ($(TOOLCHAIN),) +SRCS += out/builtins.c +else +SRCS += tools/builtins.c endif +$(call program,debugger,$(SRCS)) -OUT := out -BIN := bin -OUT_HOST_OBJ := $(OUT)/_obj/host -OUT_TARGET_OBJ := $(OUT)/_obj/target -ALL := -DEPS := -AGENTS := +ifneq ($(TOOLCHAIN),) +# if there's a cross-compiler, build agents from source -# build system internals -include build/build.mk +$(call agent, lpclink2, 0x10080400) +$(call agent, stm32f4xx, 0x20000400) +$(call agent, lpc13xx, 0x10000400) +$(call agent, lpc15xx, 0x02000400) -# architecture configurations -include $(wildcard arch/*/config.mk) +# tool to pack the agents into a source file +SRCS := tools/mkbuiltins.c +$(call program,mkbuiltins,$(SRCS)) -# additional modules -include $(wildcard */module.mk) +AGENT_BINS := $(patsubst %,out/agent-%.bin,$(AGENTS)) -clean:: - @echo clean - @rm -rf $(OUT) $(BIN) +out/builtins.c: $(AGENT_BINS) bin/mkbuiltins + @mkdir -p $(dir $@) + @echo generate $@ + $(QUIET)./bin/mkbuiltins $(AGENT_BINS) > $@ +endif -# we generate .d as a side-effect of compiling. override generic rule: -%.d: -include $(DEPS) -all:: $(ALL) +all: $(ALL) +clean:: + rm -rf out bin diff --git a/agents/lpc13xx.c b/agents/lpc13xx.c @@ -0,0 +1,5 @@ +#define LOADADDR 0x10000400 +#define FLASH_BASE 0x00000000 +#define FLASH_SIZE 0x00008000 + +#include "lpc13xx_lpc15xx.c" diff --git a/agents/lpc13xx_lpc15xx.c b/agents/lpc13xx_lpc15xx.c @@ -16,7 +16,7 @@ #include <agent/flash.h> -#ifdef CONFIG_ARCH_LPC15XX +#ifdef ARCH_LPC15XX #define LPC_IAP_FUNC 0x03000205 #else #define LPC_IAP_FUNC 0x1fff1ff1 @@ -107,11 +107,11 @@ const flash_agent __attribute((section(".vectors"))) FlashAgent = { .magic = AGENT_MAGIC, .version = AGENT_VERSION, .flags = FLAG_BOOT_ROM_HACK, - .load_addr = CONFIG_LOADADDR, - .data_addr = CONFIG_LOADADDR + 0x400, + .load_addr = LOADADDR, + .data_addr = LOADADDR + 0x400, .data_size = 0x1000, - .flash_addr = CONFIG_FLASHADDR, - .flash_size = CONFIG_FLASHSIZE, + .flash_addr = FLASH_BASE, + .flash_size = FLASH_SIZE, .setup = flash_agent_setup, .erase = flash_agent_erase, .write = flash_agent_write, diff --git a/agents/lpc15xx.c b/agents/lpc15xx.c @@ -0,0 +1,7 @@ +#define ARCH_LPC15XX 1 + +#define LOADADDR 0x02000400 +#define FLASH_BASE 0x00000000 +#define FLASH_SIZE 0x00010000 + +#include "lpc13xx_lpc15xx.c" diff --git a/agents/lpc43xx-spifi.c b/agents/lpc43xx-spifi.c @@ -214,11 +214,11 @@ const flash_agent __attribute((section(".vectors"))) FlashAgent = { .magic = AGENT_MAGIC, .version = AGENT_VERSION, .flags = 0, - .load_addr = CONFIG_LOADADDR, - .data_addr = CONFIG_LOADADDR + 0x400, + .load_addr = LOADADDR, + .data_addr = LOADADDR + 0x400, .data_size = 0x8000, - .flash_addr = CONFIG_FLASHADDR, - .flash_size = CONFIG_FLASHSIZE, + .flash_addr = FLASH_BASE, + .flash_size = FLASH_SIZE, .setup = flash_agent_setup, .erase = flash_agent_erase, .write = flash_agent_write, diff --git a/agents/lpclink2.c b/agents/lpclink2.c @@ -0,0 +1,5 @@ +#define FLASH_BASE 0x00000000 +#define FLASH_SIZE 0x00100000 +#define LOADADDR 0x10080400 + +#include "lpc43xx-spifi.c" diff --git a/agents/stm32f4xx.c b/agents/stm32f4xx.c @@ -0,0 +1,6 @@ +#define LOADADDR 0x20000400 + +#define FLASH_BASE 0x00000000 +#define FLASH_SIZE 0x00100000 + +#include "stm32fxxx.c" diff --git a/agents/stm32fxxx.c b/agents/stm32fxxx.c @@ -17,14 +17,14 @@ #include <agent/flash.h> #include <fw/io.h> -#define FLASH_BASE 0x40023C00 -#define FLASH_ACR (FLASH_BASE + 0x00) +#define _FLASH_BASE 0x40023C00 +#define FLASH_ACR (_FLASH_BASE + 0x00) -#define FLASH_KEYR (FLASH_BASE + 0x04) +#define FLASH_KEYR (_FLASH_BASE + 0x04) #define FLASH_KEYR_KEY1 0x45670123 #define FLASH_KEYR_KEY2 0xCDEF89AB -#define FLASH_SR (FLASH_BASE + 0x0C) +#define FLASH_SR (_FLASH_BASE + 0x0C) #define FLASH_SR_BSY (1 << 16) #define FLASH_SR_PGSERR (1 << 7) // sequence error #define FLASH_SR_PGPERR (1 << 6) // parallelism error @@ -34,7 +34,7 @@ #define FLASH_SR_ERRMASK 0xF2 #define FLASH_SR_EOP (1 << 0) // end of operation -#define FLASH_CR (FLASH_BASE + 0x10) +#define FLASH_CR (_FLASH_BASE + 0x10) #define FLASH_CR_LOCK (1 << 31) #define FLASH_CR_ERRIE (1 << 25) // error irq en #define FLASH_CR_EOPIE (1 << 24) // end of op irq en @@ -129,11 +129,11 @@ const flash_agent __attribute((section(".vectors"))) FlashAgent = { .magic = AGENT_MAGIC, .version = AGENT_VERSION, .flags = 0, - .load_addr = CONFIG_LOADADDR, - .data_addr = CONFIG_LOADADDR + 0x400, + .load_addr = LOADADDR, + .data_addr = LOADADDR + 0x400, .data_size = 0x8000, - .flash_addr = CONFIG_FLASHADDR, - .flash_size = CONFIG_FLASHSIZE, + .flash_addr = FLASH_BASE, + .flash_size = FLASH_SIZE, .setup = flash_agent_setup, .erase = flash_agent_erase, .write = flash_agent_write, diff --git a/build/agent.ld b/build/agent.ld @@ -0,0 +1,32 @@ + +/* RAM only binary layout */ + +SECTIONS { + .text : { + . = ALIGN(4); + KEEP (*(.vectors)) + *(.text) + *(.text.*) + *(.rodata) + *(.rodata.*) + . = ALIGN(4); + __data_init__ = . ; + } /* >RAM */ + .data : { + . = ALIGN(4); + __data_start__ = . ; + *(.data) + *(.data.*) + . = ALIGN(4); + __data_end__ = . ; + } /* >RAM */ + .bss : { + . = ALIGN(4); + __bss_start__ = . ; + *(.bss) + *(.bss.*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = . ; + } /*>RAM */ +} diff --git a/build/build.mk b/build/build.mk @@ -1,58 +1,79 @@ -## Copyright 2014 Brian Swetland <swetland@frotz.net> -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. - -# configuration header generation heavily inspired by travisg's lk build system - -# $(call chip,name,arch,rambase,ramsize,rombase,romsize,linkscript) -define chip -$(eval CHIP_$1_ARCH := $2) \ -$(eval CHIP_$1_RAMBASE := $3) \ -$(eval CHIP_$1_RAMSIZE := $4) \ -$(eval CHIP_$1_ROMBASE := $5) \ -$(eval CHIP_$1_ROMSIZE := $6) \ -$(eval CHIP_$1_LINKSCRIPT := build/generic-$7.ld) \ -$(eval CHIP_$1_DEPS := $(lastword $(MAKEFILE_LIST))) -endef -MKDIR = if [ ! -d $(dir $@) ]; then mkdir -p $(dir $@); fi +what_to_build:: all -QUIET ?= @ +-include local.mk -SPACE := -SPACE += -COMMA := , +#TOOLCHAIN ?= arm-none-eabi- -define underscorify -$(subst /,_,$(subst \,_,$(subst .,_,$(subst -,_,$1)))) -endef +TARGET_CC := $(TOOLCHAIN)gcc +TARGET_OBJCOPY := $(TOOLCHAIN)objcopy +TARGET_OBJDUMP := $(TOOLCHAIN)objdump -define toupper -$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))) -endef +TARGET_CFLAGS := -g -Os -Wall +TARGET_CFLAGS += -Wno-unused-but-set-variable +TARGET_CFLAGS += -I. -Iinclude +TARGET_CFLAGS += -mcpu=cortex-m3 -mthumb -mthumb-interwork +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_CFLAGS += -fno-builtin -nostdlib + +# tell gcc there's not a full libc it can depend on +# so it won't do thinks like printf("...") -> puts("...") +TARGET_CFLAGS += -ffreestanding + +QUIET := @ + +UNAME := $(shell uname) +UNAME_M := $(shell uname -m) + +HOST_CFLAGS := -g -O1 -Wall +HOST_CFLAGS += -Itools -Iinclude +HOST_CFLAGS += -DLINENOISE_INTERRUPTIBLE -# (call make-config-header,outfile,configlist) -define make-config-header -echo "/* Machine Generated File - Do Not Edit */" >> $1.tmp ; \ -echo "#ifndef __$(call underscorify,$1)" >> $1.tmp ; \ -echo "#define __$(call underscorify,$1)" >> $1.tmp ; \ -$(foreach def,$2,echo "#define CONFIG_$(subst =, ,$(call underscorify,$(call toupper,$(def))))" >> $1.tmp ;) \ -echo "#endif" >> $1.tmp ; \ -mv $1.tmp $1 +ifeq ($(UNAME),Darwin) +HOST_CFLAGS += -I/opt/local/include -L/opt/local/lib +HOST_LIBS += -lusb-1.0 +endif +ifeq ($(UNAME),Linux) +HOST_LIBS += -lusb-1.0 -lpthread -lrt +endif + +AGENTS := +ALL := +DEPS := + +out/agent-%.bin: out/agent-%.elf + @mkdir -p $(dir $@) + @echo generate $@ + $(QUIET)$(TARGET_OBJCOPY) -O binary $< $@ + +out/agent-%.lst: out/agent-%.elf + @mkdir -p $(dir $@) + @echo generate $@ + $(QUIET)$(TARGET_OBJDUMP) -d $< > $@ + +out/agent-%.elf: agents/%.c + @mkdir -p $(dir $@) + @echo compile $@ + $(QUIET)$(TARGET_CC) $(TARGET_CFLAGS) -Wl,--script=build/agent.ld -Wl,-Ttext=$(LOADADDR) -o $@ $< + +out/%.o: %.c + @mkdir -p $(dir $@) + @echo compile $< + $(QUIET)gcc -MMD -MP -c $(HOST_CFLAGS) -o $@ $< + +define _program +ALL += bin/$1 +DEPS += $3 +bin/$1: $2 + @mkdir -p $$(dir $$@) + @echo link $$@ + $(QUIET)gcc -o $$@ $2 $(HOST_LIBS) endef -start-module-mk = $(eval M_MAKEFILE := $(lastword $(MAKEFILE_LIST))) -build-target-agent = $(eval include build/target-agent.mk) -build-target-executable = $(eval include build/target-executable.mk) -build-host-executable = $(eval include build/host-executable.mk) +program = $(eval $(call _program,$1,$(patsubst %.c,out/%.o,$2),$(patsubst %.c,out/%.d,$2))) + +agent = $(eval AGENTS += $(strip $1))\ +$(eval ALL += $(patsubst %,out/agent-%.bin,$(strip $1)))\ +$(eval ALL += $(patsubst %,out/agent-%.lst,$(strip $1)))\ +$(eval out/agent-$(strip $1).elf: LOADADDR := $(strip $2)) diff --git a/tools/builtins.c b/tools/builtins.c @@ -0,0 +1,123 @@ +/* this file is machine-generated by mkbuiltins -- do not modify */ + +#include <string.h> +#include <stdint.h> + +static struct { + const char *name; + size_t size; + void *data; +} files[] = { + { "agent-lpclink2.bin", 576, + "\x66\x61\x77\x42\x00\x00\x01\x00\x00\x00\x00\x00\x00\x04\x08\x10" + "\x00\x08\x08\x10\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x71\x04\x08\x10\x9D\x05\x08\x10\xC1\x04\x08\x10\xB9\x04\x08\x10" + "\x07\x49\x0B\x68\x06\x4A\x13\xF0\x02\x0F\xFA\xD1\x05\x49\x06\x4B" + "\x19\x60\x13\x68\x9B\x07\xFC\xD4\x04\x4B\x1B\x78\x70\x47\x00\xBF" + "\x1C\x30\x00\x40\x00\x40\x20\x05\x04\x30\x00\x40\x14\x30\x00\x40" + "\x0C\x4B\x0D\x49\x13\x22\x1A\x60\x53\x23\x0B\x60\x4B\x60\x8B\x60" + "\xCB\x60\x0A\x4B\x1A\x60\xA3\xF5\x03\x23\xA3\xF5\xC2\x73\x10\x22" + "\x1A\x60\x18\x68\x10\xF0\x10\x00\xFB\xD1\x05\x4A\x05\x4B\x1A\x60" + "\x70\x47\x00\xBF\x8C\x61\x08\x40\x90\x61\x08\x40\xA0\x61\x08\x40" + "\xFF\xFF\x0F\x00\x00\x30\x00\x40\x6F\xF0\x01\x00\x70\x47\x00\x00" + "\xC0\xF3\x0B\x03\x2D\xE9\xF0\x47\x15\x46\x00\x2B\x4F\xD1\xDF\xF8" + "\xC4\x80\x01\xF5\x80\x74\xC2\x46\xA4\xF5\x80\x76\x00\x2D\x3A\xD0" + "\xFF\x2D\x04\xD9\x26\x4F\x4F\xF0\xC4\x63\x3B\x60\x06\xE0\x73\x19" + "\x00\x22\x03\xF8\x01\x2B\xA3\x42\xFB\xD1\xF3\xE7\xD8\xF8\x00\x30" + "\x99\x07\xFB\xD4\x1F\x4B\xDF\xF8\x90\x90\x1F\x4A\xC9\xF8\x00\x00" + "\x3B\x60\x33\x46\x9C\x42\x03\xD0\x53\xF8\x04\x1B\x11\x60\xF9\xE7" + "\xFF\xF7\x8E\xFF\x19\x4B\x18\x4A\xC9\xF8\x00\x00\x3B\x60\x00\x23" + "\xA6\x42\x07\xD0\x17\x68\x56\xF8\x04\x1B\x8F\x42\x18\xBF\x4F\xF0" + "\xFF\x33\xF5\xE7\xDA\xF8\x00\x20\x92\x07\xFB\xD4\x9B\xB9\xFF\x2D" + "\x04\xF5\x80\x74\x06\xD8\x0E\x4B\x4F\xF0\x60\x72\x1A\x60\x00\x20" + "\xBD\xE8\xF0\x87\xA5\xF5\x80\x75\x00\xF5\x80\x70\xB4\xE7\x6F\xF0" + "\x02\x00\xBD\xE8\xF0\x87\x4F\xF0\xFF\x30\xBD\xE8\xF0\x87\x00\xBF" + "\x04\x30\x00\x40\x00\x81\x80\x02\x14\x30\x00\x40\x00\x01\x80\x03" + "\x18\x30\x00\x40\x1C\x30\x00\x40\x08\x30\x00\x40\x2D\xE9\xF8\x4F" + "\xC0\xF3\x0B\x03\x88\x46\x00\x2B\x37\xD1\xDF\xF8\x8C\x90\x0D\x46" + "\xCA\x46\x00\xEB\x08\x06\x76\x1B\x4D\xB3\x1C\x4F\x4F\xF0\xC4\x63" + "\x3B\x60\xD9\xF8\x00\x30\x13\xF0\x02\x04\xFA\xD1\xDF\xF8\x6C\xB0" + "\x4F\xF0\x02\x53\xCB\xF8\x00\x60\x3B\x60\xFF\xF7\x31\xFF\x14\x4B" + "\xCB\xF8\x00\x60\x40\xF2\x01\x42\x3B\x60\x23\x46\x11\x49\x01\x3A" + "\x05\xD0\x0C\x68\x01\x34\x18\xBF\x4F\xF0\xFF\x33\xF7\xE7\xDA\xF8" + "\x00\x20\x92\x07\xFB\xD4\x63\xB9\xB5\xF5\x80\x5F\x02\xD2\x00\x20" + "\xBD\xE8\xF8\x8F\xA5\xF5\x80\x55\xCB\xE7\x6F\xF0\x02\x00\xBD\xE8" + "\xF8\x8F\x4F\xF0\xFF\x30\xBD\xE8\xF8\x8F\x00\xBF\x04\x30\x00\x40" + "\x00\x10\x80\x03\x14\x30\x00\x40\x1C\x30\x00\x40\x08\x30\x00\x40" + }, + { "agent-stm32f4xx.bin", 328, + "\x66\x61\x77\x42\x00\x00\x01\x00\x00\x00\x00\x00\x00\x04\x00\x20" + "\x00\x08\x00\x20\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x41\x04\x00\x20\x5D\x04\x00\x20\xC9\x04\x00\x20\xC1\x04\x00\x20" + "\x04\x4B\x05\x4A\x1A\x60\x02\xF1\x88\x32\x1A\x60\xD8\x68\xC0\x17" + "\x70\x47\x00\xBF\x04\x3C\x02\x40\x23\x01\x67\x45\xF0\xB5\x04\x46" + "\x14\x4B\x00\x22\x53\xF8\x22\x00\x12\x4E\xA0\x42\x05\xD0\x01\x32" + "\x0C\x2A\xF7\xD1\x6F\xF0\x02\x00\xF0\xBD\x0F\x4D\x0F\x4F\xD3\x00" + "\x43\xF0\x02\x00\x43\xF4\x80\x33\x43\xF0\x02\x03\x28\x60\x2B\x60" + "\x3B\x68\xD8\x03\xFC\xD4\x13\xF0\xF2\x00\x08\xD1\x01\x32\x0C\x2A" + "\x07\xD0\x56\xF8\x22\x30\x1B\x1B\x8B\x42\xE8\xD3\xF0\xBD\x4F\xF0" + "\xFF\x30\xF0\xBD\x14\x05\x00\x20\x10\x3C\x02\x40\x0C\x3C\x02\x40" + "\x6F\xF0\x01\x00\x70\x47\x00\x00\x40\xEA\x02\x03\x9B\x07\xF0\xB5" + "\x19\xD1\x40\xF2\x01\x24\x0D\x4B\x0D\x4E\x1C\x60\x0C\x46\x45\x1A" + "\x10\x1B\x08\x18\x0D\xD0\x20\x68\x60\x51\x04\x34\x30\x68\x10\xF4" + "\x80\x37\xFB\xD1\x10\xF0\xF2\x0F\xF2\xD0\x1F\x60\x4F\xF0\xFF\x30" + "\xF0\xBD\x18\x60\xF0\xBD\x6F\xF0\x02\x00\xF0\xBD\x10\x3C\x02\x40" + "\x0C\x3C\x02\x40\x00\x00\x00\x00\x00\x40\x00\x00\x00\x80\x00\x00" + "\x00\xC0\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x04\x00" + "\x00\x00\x06\x00\x00\x00\x08\x00\x00\x00\x0A\x00\x00\x00\x0C\x00" + "\x00\x00\x0E\x00\x00\x00\x10\x00" + }, + { "agent-lpc13xx.bin", 284, + "\x66\x61\x77\x42\x00\x00\x01\x00\x01\x00\x00\x00\x00\x04\x00\x10" + "\x00\x08\x00\x10\x00\x10\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x41\x04\x00\x10\x45\x04\x00\x10\x9D\x04\x00\x10\x15\x05\x00\x10" + "\x00\x20\x70\x47\x70\xB5\x01\x39\x05\x0B\xC0\xF3\x0B\x00\x8A\xB0" + "\x05\xEB\x11\x34\xC8\xB9\x32\x23\x05\x93\x06\x95\x07\x94\x0E\x4E" + "\x01\xA9\x05\xA8\xB0\x47\x01\x9B\x93\xB9\x34\x23\x05\x93\x42\xF6" + "\xE0\x63\x05\xA8\x06\x95\x07\x94\x08\x93\x01\xA9\xB0\x47\x01\x98" + "\x00\x30\x18\xBF\x01\x20\x40\x42\x04\xE0\x6F\xF0\x02\x00\x01\xE0" + "\x4F\xF0\xFF\x30\x0A\xB0\x70\xBD\xF1\x1F\xFF\x1F\x70\xB5\x14\x46" + "\xC0\xF3\x0B\x02\x8A\xB0\x05\x46\x0E\x46\x03\x0B\x42\xBB\x32\x22" + "\x06\x93\x07\x93\x05\x92\x16\x4B\x01\xA9\x05\xA8\x98\x47\x01\x9B" + "\x0B\xBB\xB4\xF5\x80\x5F\x13\xD1\x33\x23\x05\x93\x4F\xF4\x80\x53" + "\x08\x93\x42\xF6\xE0\x63\x05\xA8\x09\x93\x06\x95\x07\x96\x01\xA9" + "\x0B\x4B\x98\x47\x01\x98\x00\x30\x18\xBF\x01\x20\x40\x42\x0C\xE0" + "\x32\x19\x91\x1B\xB1\xF5\x80\x5F\xE6\xDA\x02\xF8\x01\x3B\xF8\xE7" + "\x6F\xF0\x02\x00\x01\xE0\x4F\xF0\xFF\x30\x0A\xB0\x70\xBD\x00\xBF" + "\xF1\x1F\xFF\x1F\x6F\xF0\x01\x00\x70\x47\x00\x00" + }, + { "agent-lpc15xx.bin", 284, + "\x66\x61\x77\x42\x00\x00\x01\x00\x01\x00\x00\x00\x00\x04\x00\x02" + "\x00\x08\x00\x02\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x41\x04\x00\x02\x45\x04\x00\x02\x9D\x04\x00\x02\x15\x05\x00\x02" + "\x00\x20\x70\x47\x70\xB5\x01\x39\x05\x0B\xC0\xF3\x0B\x00\x8A\xB0" + "\x05\xEB\x11\x34\xC8\xB9\x32\x23\x05\x93\x06\x95\x07\x94\x0E\x4E" + "\x01\xA9\x05\xA8\xB0\x47\x01\x9B\x93\xB9\x34\x23\x05\x93\x42\xF6" + "\xE0\x63\x05\xA8\x06\x95\x07\x94\x08\x93\x01\xA9\xB0\x47\x01\x98" + "\x00\x30\x18\xBF\x01\x20\x40\x42\x04\xE0\x6F\xF0\x02\x00\x01\xE0" + "\x4F\xF0\xFF\x30\x0A\xB0\x70\xBD\x05\x02\x00\x03\x70\xB5\x14\x46" + "\xC0\xF3\x0B\x02\x8A\xB0\x05\x46\x0E\x46\x03\x0B\x42\xBB\x32\x22" + "\x06\x93\x07\x93\x05\x92\x16\x4B\x01\xA9\x05\xA8\x98\x47\x01\x9B" + "\x0B\xBB\xB4\xF5\x80\x5F\x13\xD1\x33\x23\x05\x93\x4F\xF4\x80\x53" + "\x08\x93\x42\xF6\xE0\x63\x05\xA8\x09\x93\x06\x95\x07\x96\x01\xA9" + "\x0B\x4B\x98\x47\x01\x98\x00\x30\x18\xBF\x01\x20\x40\x42\x0C\xE0" + "\x32\x19\x91\x1B\xB1\xF5\x80\x5F\xE6\xDA\x02\xF8\x01\x3B\xF8\xE7" + "\x6F\xF0\x02\x00\x01\xE0\x4F\xF0\xFF\x30\x0A\xB0\x70\xBD\x00\xBF" + "\x05\x02\x00\x03\x6F\xF0\x01\x00\x70\x47\x00\x00" + }, +}; + +void *get_builtin_file(const char *name, size_t *sz) { + int n; + for (n = 0; n < (sizeof(files)/sizeof(files[0])); n++) { + if (!strcmp(name, files[n].name)) { + *sz = files[n].size; + return files[n].data; + } + } + return NULL; +} diff --git a/tools/debugger-commands.c b/tools/debugger-commands.c @@ -48,6 +48,7 @@ extern int disassemble_thumb2(u32 addr, u16 op0, u16 op1, char *text, int len) __attribute__ ((weak)); int disassemble(u32 addr) { +#if WITH_THUMB2_DISASSEMBLE char text[128]; int r; union { @@ -55,7 +56,6 @@ int disassemble(u32 addr) { u16 h[4]; } mem; -#if WITH_THUMB2_DISASSEMBLE if (!disassemble_thumb2) return -1;