Merge pull request #108 from lbonn/upstream-patches

Some various fixes
This commit is contained in:
Gareth McMullin 2016-03-09 10:27:34 +13:00
commit cc244eb2d8
4 changed files with 17 additions and 15 deletions

View File

@ -11,17 +11,12 @@ endif
CFLAGS=-Os -std=gnu99 -mcpu=cortex-m0 -mthumb -I../libopencm3/include CFLAGS=-Os -std=gnu99 -mcpu=cortex-m0 -mthumb -I../libopencm3/include
ASFLAGS=-mcpu=cortex-m3 -mthumb ASFLAGS=-mcpu=cortex-m3 -mthumb
all: lmi.stub stm32f4.stub stm32l4.stub nrf51.stub stm32f1.stub all: lmi.stub stm32f4.stub stm32l4.stub nrf51.stub stm32f1.stub efm32.stub
stm32f1.o: stm32f1.c stm32f1.o: CFLAGS += -DSTM32F1
$(Q)echo " CC $<" stm32f4.o: CFLAGS += -DSTM32F4
$(Q)$(CC) $(CFLAGS) -DSTM32F1 -o $@ -c $<
stm32f4.o: stm32f4.c %.o: %.c
$(Q)echo " CC $<"
$(Q)$(CC) $(CFLAGS) -DSTM32F4 -o $@ -c $<
stm32l4.o: stm32l4.c
$(Q)echo " CC $<" $(Q)echo " CC $<"
$(Q)$(CC) $(CFLAGS) -o $@ -c $< $(Q)$(CC) $(CFLAGS) -o $@ -c $<

View File

@ -97,13 +97,19 @@ uint32_t crc32_calc(uint32_t crc, uint8_t data)
uint32_t generic_crc32(target *t, uint32_t base, int len) uint32_t generic_crc32(target *t, uint32_t base, int len)
{ {
uint32_t crc = -1; uint32_t crc = -1;
uint8_t byte; static uint8_t bytes[128];
while (len--) { while (len) {
byte = target_mem_read8(t, base); uint32_t i;
uint32_t read_len = len >= 128 ? 128 : len;
crc = crc32_calc(crc, byte); target_mem_read(t, bytes, base, read_len);
base++;
for (i=0; i<read_len; i++)
crc = crc32_calc(crc, bytes[i]);
base += read_len;
len -= read_len;
} }
return crc; return crc;
} }

View File

@ -334,6 +334,7 @@ bool efm32_probe(target *t)
uint32_t ram_size = efm32_read_ram_size(t) * 0x400; uint32_t ram_size = efm32_read_ram_size(t) * 0x400;
/* Setup Target */ /* Setup Target */
t->target_options |= CORTEXM_TOPT_INHIBIT_SRST;
t->driver = variant_string; t->driver = variant_string;
gdb_outf("flash size %d page size %d\n", flash_size, flash_page_size); gdb_outf("flash size %d page size %d\n", flash_size, flash_page_size);
target_add_ram (t, SRAM_BASE, ram_size); target_add_ram (t, SRAM_BASE, ram_size);

View File

@ -41,7 +41,7 @@
#define ERROR_IF_NO_TARGET() \ #define ERROR_IF_NO_TARGET() \
if(!cur_target) { gdb_putpacketz("EFF"); break; } if(!cur_target) { gdb_putpacketz("EFF"); break; }
static char pbuf[BUF_SIZE]; static char pbuf[BUF_SIZE+1];
static target *cur_target; static target *cur_target;
static target *last_target; static target *last_target;