Merge pull request #14 from bikeNomad/master

Minor improvements to utilities and example makefile
pull/16/head
texane 2011-10-19 22:15:54 -07:00
commit 9eaafd0519
3 zmienionych plików z 31 dodań i 4 usunięć

Wyświetl plik

@ -15,7 +15,7 @@ LDFLAGS=-lstlink -lusb-1.0 -lsgutils2 -L.
LIBRARY=libstlink.a
all: $(LIBRARY) test_usb test_sg
all: $(LIBRARY) flash gdbserver test_usb test_sg
$(LIBRARY): $(OBJS_LIB)
@echo "objs are $(OBJS_LIB)"
@ -42,5 +42,15 @@ clean:
rm -rf $(LIBRARY)
rm -rf test_usb*
rm -rf test_sg*
distclean: clean
$(MAKE) -C flash clean
$(MAKE) -C gdbserver clean
.PHONY: clean all
flash:
$(MAKE) -C flash
gdbserver:
$(MAKE) -C gdbserver
.PHONY: clean all flash gdbserver

Wyświetl plik

@ -5,7 +5,18 @@ CC=arm-none-eabi-gcc
OBJCOPY=arm-none-eabi-objcopy
CFLAGS=-O2 -mlittle-endian -mthumb
CFLAGS+=-mcpu=cortex-m3 -ffreestanding -nostdlib -nostdinc
CFLAGS=-g -O2 -mlittle-endian -mthumb
ifeq ($(CONFIG_STM32L_DISCOVERY), 1)
CFLAGS+=-mcpu=cortex-m3 -DCONFIG_STM32L_DISCOVERY
else ifeq ($(CONFIG_STM32VL_DISCOVERY), 1)
CFLAGS+=-mcpu=cortex-m3 -DCONFIG_STM32VL_DISCOVERY=1
else ifeq ($(CONFIG_STM32F4_DISCOVERY), 1)
CFLAGS+=-mcpu=cortex-m4 -DCONFIG_STM32F4_DISCOVERY=1
else
$(error "must specify CONFIG_ for board!")
endif
CFLAGS+=-ffreestanding -nostdlib -nostdinc
# to run from FLASH
CFLAGS+=-Wl,-T,stm32_flash.ld

Wyświetl plik

@ -17,6 +17,11 @@ struct opts
size_t size;
};
static void usage(void)
{
puts("stlinkv1 command line: ./flash {read|write} /dev/sgX path addr <size>");
puts("stlinkv2 command line: ./flash {read|write} path addr <size>");
}
static int get_opts(struct opts* o, int ac, char** av)
{
@ -75,6 +80,7 @@ int main(int ac, char** av)
if (get_opts(&o, ac - 1, av + 1) == -1)
{
printf("invalid command line\n");
usage();
goto on_error;
}
@ -86,7 +92,7 @@ int main(int ac, char** av)
}
else /* stlinkv2 */
{
sl = stlink_open_usb(NULL, 10);
sl = stlink_open_usb(10);
if (sl == NULL) goto on_error;
}