commit 1b6f652834f311b559605f08e8f22031e350f9e0 Author: eddyem Date: Sat Mar 21 22:48:29 2015 +0300 first run diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..842ef51 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*~ +*.bak +*.bck +*-cache.lib +*.kicad_pcb-bak +*.dcm +*.pho +*.drl +*.pdf +.hg* +.dropbox.attr diff --git a/README b/README new file mode 100644 index 0000000..22f5aea --- /dev/null +++ b/README @@ -0,0 +1 @@ +These are files for simplify development under STM32F1xx with libopencm3 diff --git a/client-term/Makefile b/client-term/Makefile new file mode 100644 index 0000000..19bac1f --- /dev/null +++ b/client-term/Makefile @@ -0,0 +1,22 @@ +PROGRAM = client +LDFLAGS = +SRCS = client.c +CC = gcc +DEFINES = -D_XOPEN_SOURCE=501 +CXX = gcc +CFLAGS = -Wall -Werror $(DEFINES) +OBJS = $(SRCS:.c=.o) +all : $(PROGRAM) clean +$(PROGRAM) : $(OBJS) + $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(PROGRAM) + +# some addition dependencies +# %.o: %.c +# $(CC) $(LDFLAGS) $(CFLAGS) $< -o $@ +#$(SRCS) : %.c : %.h $(INDEPENDENT_HEADERS) +# @touch $@ + +clean: + /bin/rm -f *.o *~ +depend: + $(CXX) -MM $(CXX.SRCS) diff --git a/client-term/client.c b/client-term/client.c new file mode 100644 index 0000000..5f565e0 --- /dev/null +++ b/client-term/client.c @@ -0,0 +1,273 @@ +/* + * client.c - simple terminal client + * + * Copyright 2013 Edward V. Emelianoff + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ +#include // tcsetattr +#include // tcsetattr, close, read, write +#include // ioctl +#include // printf, getchar, fopen, perror +#include // exit +#include // read +#include // read +#include // signal +#include // time +#include // memcpy +#include // int types +#include // gettimeofday + +#define BUFLEN 1024 + +double t0; // start time + +FILE *fout = NULL; // file for messages duplicating +char *comdev = "/dev/ttyACM0"; +int BAUD_RATE = B115200; +struct termio oldtty, tty; // TTY flags +struct termios oldt, newt; // terminal flags +int comfd; // TTY fd + +#define DBG(...) do{fprintf(stderr, __VA_ARGS__);}while(0) + +/** + * function for different purposes that need to know time intervals + * @return double value: time in seconds + */ +double dtime(){ + double t; + struct timeval tv; + gettimeofday(&tv, NULL); + t = tv.tv_sec + ((double)tv.tv_usec)/1e6; + return t; +} + +/** + * Exit & return terminal to old state + * @param ex_stat - status (return code) + */ +void quit(int ex_stat){ + tcsetattr(STDIN_FILENO, TCSANOW, &oldt); // return terminal to previous state + ioctl(comfd, TCSANOW, &oldtty ); // return TTY to previous state + close(comfd); + if(fout) fclose(fout); + printf("Exit! (%d)\n", ex_stat); + exit(ex_stat); +} + +/** + * Open & setup TTY, terminal + */ +void tty_init(){ + // terminal without echo + tcgetattr(STDIN_FILENO, &oldt); + newt = oldt; + newt.c_lflag &= ~(ICANON | ECHO); + if(tcsetattr(STDIN_FILENO, TCSANOW, &newt) < 0) quit(-2); + printf("\nOpen port...\n"); + if ((comfd = open(comdev,O_RDWR|O_NOCTTY|O_NONBLOCK)) < 0){ + fprintf(stderr,"Can't use port %s\n",comdev); + quit(1); + } + printf(" OK\nGet current settings...\n"); + if(ioctl(comfd,TCGETA,&oldtty) < 0) exit(-1); // Get settings + tty = oldtty; + tty.c_lflag = 0; // ~(ICANON | ECHO | ECHOE | ISIG) + tty.c_oflag = 0; + tty.c_cflag = BAUD_RATE|CS8|CREAD|CLOCAL; // 9.6k, 8N1, RW, ignore line ctrl + tty.c_cc[VMIN] = 0; // non-canonical mode + tty.c_cc[VTIME] = 5; + if(ioctl(comfd,TCSETA,&tty) < 0) exit(-1); // set new mode + printf(" OK\n"); + tcsetattr(STDIN_FILENO, TCSANOW, &newt); +} + +/** + * getchar() without echo + * wait until at least one character pressed + * @return character readed + * +int mygetchar(){ + int ret; + do ret = read_console(); + while(ret == 0); + return ret; +}*/ + +/** + * read both tty & console + * @param buff (o) - buffer for messages readed from tty + * @param length (io) - buff's length (return readed len or 0) + * @param rb (o) - byte readed from console or -1 + * @return 1 if something was readed here or there + */ +int read_tty_and_console(char *buff, size_t *length, int *rb){ + ssize_t L; + // ssize_t l; + size_t buffsz = *length; + struct timeval tv; + int sel, retval = 0; + fd_set rfds; + FD_ZERO(&rfds); + FD_SET(STDIN_FILENO, &rfds); + FD_SET(comfd, &rfds); + tv.tv_sec = 0; tv.tv_usec = 10000; + sel = select(comfd + 1, &rfds, NULL, NULL, &tv); + if(sel > 0){ + if(FD_ISSET(STDIN_FILENO, &rfds)){ + *rb = getchar(); + retval = 1; + }else{ + *rb = -1; + } + if(FD_ISSET(comfd, &rfds)){ + if((L = read(comfd, buff, buffsz)) < 1){ // disconnect or other troubles + fprintf(stderr, "USB error or disconnected!\n"); + quit(1); + }else{ + if(L == 0){ // USB disconnected + fprintf(stderr, "USB disconnected!\n"); + quit(1); + } + // all OK continue reading + /* DBG("readed %zd bytes, try more.. ", L); + buffsz -= L; + while(buffsz > 0 && (l = read(comfd, buff+L, buffsz)) > 0){ + L += l; + buffsz -= l; + } + DBG("full len: %zd\n", L); */ + *length = (size_t) L; + retval = 1; + } + }else{ + *length = 0; + } + } + return retval; +} + +void help(){ + printf("Use this commands:\n" + "h\tShow this help\n" + "q\tQuit\n" + ); +} + +void con_sig(int rb){ + char cmd; + if(rb < 1) return; + if(rb == 'q') quit(0); // q == exit + cmd = (char) rb; + write(comfd, &cmd, 1); + /*switch(rb){ + case 'h': + help(); + break; + default: + cmd = (uint8_t) rb; + write(comfd, &cmd, 1); + }*/ +} + +/** + * Get integer value from buffer + * @param buff (i) - buffer with int + * @param len - length of data in buffer (could be 2 or 4) + * @return + */ +uint32_t get_int(char *buff, size_t len){ + if(len != 2 && len != 4){ + fprintf(stdout, "Bad data length!\n"); + return 0xffffffff; + } + uint32_t data = 0; + uint8_t *i8 = (uint8_t*) &data; + if(len == 2) memcpy(i8, buff, 2); + else memcpy(i8, buff, 4); + return data; +} + +/** + * Copy line by line buffer buff to file removing cmd starting from newline + * @param buffer - data to put into file + * @param cmd - symbol to remove from line startint (if found, change *cmd to (-1) + * or NULL, (-1) if no command to remove + */ +void copy_buf_to_file(char *buffer, int *cmd){ + char *buff, *line, *ptr; + if(!cmd || *cmd < 0){ + fprintf(fout, "%s", buffer); + return; + } + buff = strdup(buffer), ptr = buff; + do{ + if(!*ptr) break; + if(ptr[0] == (char)*cmd){ + *cmd = -1; + ptr++; + if(ptr[0] == '\n') ptr++; + if(!*ptr) break; + } + line = ptr; + ptr = strchr(buff, '\n'); + if(ptr){ + *ptr++ = 0; + //fprintf(fout, "%s\n", line); + }//else + //fprintf(fout, "%s", line); // no newline found in buffer + fprintf(fout, "%s\n", line); + }while(ptr); + free(buff); +} + +int main(int argc, char *argv[]){ + int rb, oldcmd = -1; + char buff[BUFLEN+1]; + size_t L; + if(argc == 2){ + fout = fopen(argv[1], "a"); + if(!fout){ + perror("Can't open output file"); + exit(-1); + } + setbuf(fout, NULL); + } + tty_init(); + signal(SIGTERM, quit); // kill (-15) + signal(SIGINT, quit); // ctrl+C + signal(SIGQUIT, SIG_IGN); // ctrl+\ . + signal(SIGTSTP, SIG_IGN); // ctrl+Z + setbuf(stdout, NULL); + t0 = dtime(); + while(1){ + L = BUFLEN; + if(read_tty_and_console(buff, &L, &rb)){ + if(rb > 0){ + con_sig(rb); + oldcmd = rb; + } + if(L){ + buff[L] = 0; + printf("%s", buff); + if(fout){ + copy_buf_to_file(buff, &oldcmd); + } + } + } + } +} diff --git a/simple_cdc/Makefile b/simple_cdc/Makefile new file mode 100644 index 0000000..9f5db65 --- /dev/null +++ b/simple_cdc/Makefile @@ -0,0 +1,133 @@ +BINARY = usb_cdc_simple +BOOTPORT ?= /dev/ttyUSB0 +BOOTSPEED ?= 115200 +# change this linking script depending on particular MCU model, +# for example, if you have STM32F103VBT6, you should write: +LDSCRIPT = ld/stm32f103xB.ld +LIBNAME = opencm3_stm32f1 +DEFS = -DSTM32F1 -DEBUG + +OBJDIR = mk +INDEPENDENT_HEADERS= + +FP_FLAGS ?= -msoft-float +ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd + +############################################################################### +# Executables +PREFIX ?= arm-none-eabi + +RM := rm -f +RMDIR := rmdir +CC := $(PREFIX)-gcc +LD := $(PREFIX)-gcc +AR := $(PREFIX)-ar +AS := $(PREFIX)-as +OBJCOPY := $(PREFIX)-objcopy +OBJDUMP := $(PREFIX)-objdump +GDB := $(PREFIX)-gdb +STFLASH = $(shell which st-flash) +STBOOT = $(shell which stm32flash) + +############################################################################### +# Source files +LDSCRIPT ?= $(BINARY).ld +SRC = $(wildcard *.c) +OBJS = $(addprefix $(OBJDIR)/, $(SRC:%.c=%.o)) + +ifeq ($(strip $(OPENCM3_DIR)),) +OPENCM3_DIR := /usr/local/arm-none-eabi +$(info Using $(OPENCM3_DIR) path to library) +endif + +INCLUDE_DIR = $(OPENCM3_DIR)/include +LIB_DIR = $(OPENCM3_DIR)/lib +SCRIPT_DIR = $(OPENCM3_DIR)/scripts + +############################################################################### +# C flags +CFLAGS += -Os -g +CFLAGS += -Wall -Wextra -Wshadow -Wimplicit-function-declaration +CFLAGS += -Wredundant-decls +# -Wmissing-prototypes -Wstrict-prototypes +CFLAGS += -fno-common -ffunction-sections -fdata-sections + +############################################################################### +# C & C++ preprocessor common flags +CPPFLAGS += -MD +CPPFLAGS += -Wall -Werror +CPPFLAGS += -I$(INCLUDE_DIR) $(DEFS) + +############################################################################### +# Linker flags +LDFLAGS += --static -nostartfiles +LDFLAGS += -L$(LIB_DIR) +LDFLAGS += -T$(LDSCRIPT) +LDFLAGS += -Wl,-Map=$(*).map +LDFLAGS += -Wl,--gc-sections + +############################################################################### +# Used libraries +LDLIBS += -l$(LIBNAME) +LDLIBS += -Wl,--start-group -lc -lgcc -Wl,--end-group + +.SUFFIXES: .elf .bin .hex .srec .list .map .images +.SECONDEXPANSION: +.SECONDARY: + +ELF := $(OBJDIR)/$(BINARY).elf +LIST := $(OBJDIR)/$(BINARY).list +BIN := $(BINARY).bin +HEX := $(BINARY).hex + +all: bin + +elf: $(ELF) +bin: $(BIN) +hex: $(HEX) +list: $(LIST) + +$(OBJDIR): + mkdir $(OBJDIR) + +$(OBJDIR)/%.o: %.c + @printf " CC $<\n" + $(CC) $(CFLAGS) $(CPPFLAGS) $(ARCH_FLAGS) -o $@ -c $< + +$(SRC) : %.c : %.h $(INDEPENDENT_HEADERS) + @touch $@ + +%.h: ; + +$(BIN): $(ELF) + @printf " OBJCOPY $(BIN)\n" + $(OBJCOPY) -Obinary $(ELF) $(BIN) + +$(HEX): $(ELF) + @printf " OBJCOPY $(HEX)\n" + $(OBJCOPY) -Oihex $(ELF) $(HEX) + +$(LIST): $(ELF) + @printf " OBJDUMP $(LIST)\n" + $(OBJDUMP) -S $(ELF) > $(LIST) + +$(ELF): $(OBJDIR) $(OBJS) $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a + @printf " LD $(ELF)\n" + $(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(ELF) + +clean: + @printf " CLEAN\n" + $(RM) $(OBJS) $(OBJDIR)/*.d $(ELF) $(HEX) $(LIST) $(OBJDIR)/*.map + $(RMDIR) $(OBJDIR) + +flash: $(BIN) + @printf " FLASH $(BIN)\n" + $(STFLASH) write $(BIN) 0x8000000 + +boot: $(BIN) + @printf " LOAD $(BIN) through bootloader\n" + $(STBOOT) -b$(BOOTSPEED) $(BOOTPORT) -w $(BIN) + +.PHONY: clean elf hex list flash boot + +#-include $(OBJS:.o=.d) diff --git a/simple_cdc/cdcacm.c b/simple_cdc/cdcacm.c new file mode 100644 index 0000000..5f032ad --- /dev/null +++ b/simple_cdc/cdcacm.c @@ -0,0 +1,314 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2010 Gareth McMullin + * Copyright 2014 Edward V. Emelianov + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#include "cdcacm.h" +#include "user_proto.h" +#include "main.h" + +// Buffer for USB Tx +static uint8_t USB_Tx_Buffer[USB_TX_DATA_SIZE]; +static uint8_t USB_Tx_ptr = 0; +// connection flag +uint8_t USB_connected = 0; +static const struct usb_device_descriptor dev = { + .bLength = USB_DT_DEVICE_SIZE, + .bDescriptorType = USB_DT_DEVICE, + .bcdUSB = 0x0200, + .bDeviceClass = USB_CLASS_CDC, + .bDeviceSubClass = 0, + .bDeviceProtocol = 0, + .bMaxPacketSize0 = 64, + .idVendor = 0x0483, + .idProduct = 0x5740, + .bcdDevice = 0x0200, + .iManufacturer = 1, + .iProduct = 2, + .iSerialNumber = 3, + .bNumConfigurations = 1, +}; + +char usbdatabuf[USB_RX_DATA_SIZE]; // buffer for received data +int usbdatalen = 0; // lenght of received data + +/* + * This notification endpoint isn't implemented. According to CDC spec its + * optional, but its absence causes a NULL pointer dereference in Linux + * cdc_acm driver. + */ +static const struct usb_endpoint_descriptor comm_endp[] = {{ + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + .bEndpointAddress = 0x83, + .bmAttributes = USB_ENDPOINT_ATTR_INTERRUPT, + .wMaxPacketSize = 16, + .bInterval = 255, +}}; + +static const struct usb_endpoint_descriptor data_endp[] = {{ + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + .bEndpointAddress = 0x01, + .bmAttributes = USB_ENDPOINT_ATTR_BULK, + .wMaxPacketSize = 64, + .bInterval = 1, +}, { + .bLength = USB_DT_ENDPOINT_SIZE, + .bDescriptorType = USB_DT_ENDPOINT, + .bEndpointAddress = 0x82, + .bmAttributes = USB_ENDPOINT_ATTR_BULK, + .wMaxPacketSize = 64, + .bInterval = 1, +}}; + +static const struct { + struct usb_cdc_header_descriptor header; + struct usb_cdc_call_management_descriptor call_mgmt; + struct usb_cdc_acm_descriptor acm; + struct usb_cdc_union_descriptor cdc_union; +} __attribute__((packed)) cdcacm_functional_descriptors = { + .header = { + .bFunctionLength = sizeof(struct usb_cdc_header_descriptor), + .bDescriptorType = CS_INTERFACE, + .bDescriptorSubtype = USB_CDC_TYPE_HEADER, + .bcdCDC = 0x0110, + }, + .call_mgmt = { + .bFunctionLength = + sizeof(struct usb_cdc_call_management_descriptor), + .bDescriptorType = CS_INTERFACE, + .bDescriptorSubtype = USB_CDC_TYPE_CALL_MANAGEMENT, + .bmCapabilities = 0, + .bDataInterface = 1, + }, + .acm = { + .bFunctionLength = sizeof(struct usb_cdc_acm_descriptor), + .bDescriptorType = CS_INTERFACE, + .bDescriptorSubtype = USB_CDC_TYPE_ACM, + .bmCapabilities = 0, + }, + .cdc_union = { + .bFunctionLength = sizeof(struct usb_cdc_union_descriptor), + .bDescriptorType = CS_INTERFACE, + .bDescriptorSubtype = USB_CDC_TYPE_UNION, + .bControlInterface = 0, + .bSubordinateInterface0 = 1, + }, +}; + +static const struct usb_interface_descriptor comm_iface[] = {{ + .bLength = USB_DT_INTERFACE_SIZE, + .bDescriptorType = USB_DT_INTERFACE, + .bInterfaceNumber = 0, + .bAlternateSetting = 0, + .bNumEndpoints = 1, + .bInterfaceClass = USB_CLASS_CDC, + .bInterfaceSubClass = USB_CDC_SUBCLASS_ACM, + .bInterfaceProtocol = USB_CDC_PROTOCOL_AT, + .iInterface = 0, + + .endpoint = comm_endp, + + .extra = &cdcacm_functional_descriptors, + .extralen = sizeof(cdcacm_functional_descriptors), +}}; + +static const struct usb_interface_descriptor data_iface[] = {{ + .bLength = USB_DT_INTERFACE_SIZE, + .bDescriptorType = USB_DT_INTERFACE, + .bInterfaceNumber = 1, + .bAlternateSetting = 0, + .bNumEndpoints = 2, + .bInterfaceClass = USB_CLASS_DATA, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, + .iInterface = 0, + + .endpoint = data_endp, +}}; + +static const struct usb_interface ifaces[] = {{ + .num_altsetting = 1, + .altsetting = comm_iface, +}, { + .num_altsetting = 1, + .altsetting = data_iface, +}}; + +static const struct usb_config_descriptor config = { + .bLength = USB_DT_CONFIGURATION_SIZE, + .bDescriptorType = USB_DT_CONFIGURATION, + .wTotalLength = 0, + .bNumInterfaces = 2, + .bConfigurationValue = 1, + .iConfiguration = 0, + .bmAttributes = 0x80, + .bMaxPower = 0x32, + + .interface = ifaces, +}; + +static const char *usb_strings[] = { + "Organisation, author", + "device", + "version", +}; + +// default line coding: B115200, 1stop, 8bits, parity none +struct usb_cdc_line_coding linecoding = { + .dwDTERate = 115200, + .bCharFormat = USB_CDC_1_STOP_BITS, + .bParityType = USB_CDC_NO_PARITY, + .bDataBits = 8, +}; + +/* Buffer to be used for control requests. */ +uint8_t usbd_control_buffer[128]; + +/** + * This function runs every time it gets a request for control parameters get/set + * parameter SET_LINE_CODING used to change USART1 parameters: if you want to + * change them, just connect through USB with required parameters + */ +static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, + uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)){ + (void)complete; + (void)buf; + (void)usbd_dev; + char local_buf[10]; + struct usb_cdc_line_coding lc; + + switch (req->bRequest) { + case SET_CONTROL_LINE_STATE:{ + if(req->wValue){ // terminal is opened + USB_connected = 1; + }else{ // terminal is closed + USB_connected = 0; + } + /* + * This Linux cdc_acm driver requires this to be implemented + * even though it's optional in the CDC spec, and we don't + * advertise it in the ACM functional descriptor. + */ + struct usb_cdc_notification *notif = (void *)local_buf; + /* We echo signals back to host as notification. */ + notif->bmRequestType = 0xA1; + notif->bNotification = USB_CDC_NOTIFY_SERIAL_STATE; + notif->wValue = 0; + notif->wIndex = 0; + notif->wLength = 2; + local_buf[8] = req->wValue & 3; + local_buf[9] = 0; + usbd_ep_write_packet(usbd_dev, 0x83, local_buf, 10); + }break; + case SET_LINE_CODING: + if (!len || (*len != sizeof(struct usb_cdc_line_coding))) + return 0; + memcpy((void *)&lc, (void *)*buf, *len); + // Mark & Space parity don't support by hardware, check it + if(lc.bParityType == USB_CDC_MARK_PARITY || lc.bParityType == USB_CDC_SPACE_PARITY){ + return 0; // error + }else{ +// memcpy((void *)&linecoding, (void *)&lc, sizeof(struct usb_cdc_line_coding)); +// UART_setspeed(USART1, &linecoding); + } + break; + case GET_LINE_CODING: // return linecoding buffer + if(len && *len == sizeof(struct usb_cdc_line_coding)) + memcpy((void *)*buf, (void *)&linecoding, sizeof(struct usb_cdc_line_coding)); + //usbd_ep_write_packet(usbd_dev, 0x83, (char*)&linecoding, sizeof(linecoding)); + break; + default: + return 0; + } + return 1; +} + +static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep){ + (void)ep; + int len = usbd_ep_read_packet(usbd_dev, 0x01, usbdatabuf + usbdatalen, USB_RX_DATA_SIZE - usbdatalen); + usbdatalen += len; + if(usbdatalen >= USB_RX_DATA_SIZE){ // buffer overflow - drop all its contents + usbdatalen = 0; + } +} + +static void cdcacm_data_tx_cb(usbd_device *usbd_dev, uint8_t ep){ + (void)ep; + (void)usbd_dev; + + usb_send_buffer(); +} + +static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue) +{ + (void)wValue; + (void)usbd_dev; + + usbd_ep_setup(usbd_dev, 0x01, USB_ENDPOINT_ATTR_BULK, USB_RX_DATA_SIZE, cdcacm_data_rx_cb); + usbd_ep_setup(usbd_dev, 0x82, USB_ENDPOINT_ATTR_BULK, USB_TX_DATA_SIZE, cdcacm_data_tx_cb); + usbd_ep_setup(usbd_dev, 0x83, USB_ENDPOINT_ATTR_INTERRUPT, 16, NULL); + + usbd_register_control_callback( + usbd_dev, + USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE, + USB_REQ_TYPE_TYPE | USB_REQ_TYPE_RECIPIENT, + cdcacm_control_request); +} + +static usbd_device *current_usb = NULL; + +usbd_device *USB_init(){ + current_usb = usbd_init(&stm32f103_usb_driver, &dev, &config, + usb_strings, 3, usbd_control_buffer, sizeof(usbd_control_buffer)); + if(!current_usb) return NULL; + usbd_register_set_config_callback(current_usb, cdcacm_set_config); + return current_usb; +} + +mutex_t send_block_mutex = MUTEX_UNLOCKED; +/** + * Put byte into USB buffer to send + * @param byte - a byte to put into a buffer + */ +void usb_send(uint8_t byte){ + mutex_lock(&send_block_mutex); + USB_Tx_Buffer[USB_Tx_ptr++] = byte; + mutex_unlock(&send_block_mutex); + if(USB_Tx_ptr == USB_TX_DATA_SIZE){ // buffer can be overflowed - send it! + usb_send_buffer(); + } +} + +/** + * Send all data in buffer over USB + * this function runs when buffer is full or on SysTick + */ +void usb_send_buffer(){ + if(MUTEX_LOCKED == mutex_trylock(&send_block_mutex)) return; + if(USB_Tx_ptr){ + if(current_usb && USB_connected){ + // usbd_ep_write_packet return 0 if previous packet isn't transmit yet + while(USB_Tx_ptr != usbd_ep_write_packet(current_usb, 0x82, USB_Tx_Buffer, USB_Tx_ptr)); + usbd_poll(current_usb); + } + USB_Tx_ptr = 0; + } + mutex_unlock(&send_block_mutex); +} diff --git a/simple_cdc/cdcacm.h b/simple_cdc/cdcacm.h new file mode 100644 index 0000000..1051d83 --- /dev/null +++ b/simple_cdc/cdcacm.h @@ -0,0 +1,54 @@ +/* + * ccdcacm.h + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#pragma once +#ifndef __CCDCACM_H__ +#define __CCDCACM_H__ + +#include + +// commands through EP0 +#define SEND_ENCAPSULATED_COMMAND 0x00 +#define GET_ENCAPSULATED_RESPONSE 0x01 +#define SET_COMM_FEATURE 0x02 +#define GET_COMM_FEATURE 0x03 +#define CLEAR_COMM_FEATURE 0x04 +#define SET_LINE_CODING 0x20 +#define GET_LINE_CODING 0x21 +#define SET_CONTROL_LINE_STATE 0x22 +#define SEND_BREAK 0x23 + +// Size of input/output buffers +#define USB_TX_DATA_SIZE 64 +#define USB_RX_DATA_SIZE 64 + +// USB connection flag +extern uint8_t USB_connected; +extern struct usb_cdc_line_coding linecoding; + +extern char usbdatabuf[]; +extern int usbdatalen; + +usbd_device *USB_init(); +void usb_send(uint8_t byte); +void usb_send_buffer(); + +#endif // __CCDCACM_H__ diff --git a/simple_cdc/hardware_ini.c b/simple_cdc/hardware_ini.c new file mode 100644 index 0000000..2f7ac43 --- /dev/null +++ b/simple_cdc/hardware_ini.c @@ -0,0 +1,56 @@ +/* + * hardware_ini.c - functions for HW initialisation + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +/* + * All hardware-dependent initialisation & definition should be placed here + * and in hardware_ini.h + * + */ + +#include "main.h" +#include "hardware_ini.h" + +/** + * GPIO initialisaion: clocking + pins setup + */ +void GPIO_init(){ + rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN | + RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN | RCC_APB2ENR_IOPDEN | + RCC_APB2ENR_IOPEEN); +/* + // USB_DISC: push-pull + gpio_set_mode(USB_DISC_PORT, GPIO_MODE_OUTPUT_2_MHZ, + GPIO_CNF_OUTPUT_PUSHPULL, USB_DISC_PIN); + // USB_POWER: open drain, externall pull down with R7 (22k) + gpio_set_mode(USB_POWER_PORT, GPIO_MODE_INPUT, + GPIO_CNF_INPUT_FLOAT, USB_POWER_PIN); +*/ +} + +/* + * SysTick used for system timer with period of 1ms + */ +void SysTick_init(){ + systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8); // Systyck: 72/8=9MHz + systick_set_reload(8999); // 9000 pulses: 1kHz + systick_interrupt_enable(); + systick_counter_enable(); +} diff --git a/simple_cdc/hardware_ini.h b/simple_cdc/hardware_ini.h new file mode 100644 index 0000000..5e00745 --- /dev/null +++ b/simple_cdc/hardware_ini.h @@ -0,0 +1,58 @@ +/* + * hardware_ini.h + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#pragma once +#ifndef __HARDWARE_INI_H__ +#define __HARDWARE_INI_H__ + +/* + * Timers: + * SysTick - system time + */ + + +void GPIO_init(); +void SysTick_init(); + +/* + * USB interface + * connect boot1 jumper to gnd, boot0 to gnd; and reconnect boot0 to +3.3 to boot flash + */ +/* +// USB_DICS (disconnect) - PC11 +#define USB_DISC_PIN GPIO11 +#define USB_DISC_PORT GPIOC +// USB_POWER (high level when USB connected to PC) +#define USB_POWER_PIN GPIO10 +#define USB_POWER_PORT GPIOC +// change signal level on USB diconnect pin +#define usb_disc_high() gpio_set(USB_DISC_PORT, USB_DISC_PIN) +#define usb_disc_low() gpio_clear(USB_DISC_PORT, USB_DISC_PIN) +// in case of n-channel FET on 1.5k pull-up change on/off disconnect means low level +// in case of pnp bipolar transistor or p-channel FET on 1.5k pull-up disconnect means high level +#define usb_disconnect() usb_disc_high() +#define usb_connect() usb_disc_low() +*/ +// my simple devboard have no variants for programmed connection/disconnection of USB +#define usb_disconnect() +#define usb_connect() + +#endif // __HARDWARE_INI_H__ diff --git a/simple_cdc/ld/devices.data b/simple_cdc/ld/devices.data new file mode 100644 index 0000000..7f29538 --- /dev/null +++ b/simple_cdc/ld/devices.data @@ -0,0 +1,9 @@ +stm32f103?4* stm32f1 ROM=16K RAM=6K +stm32f103?6* stm32f1 ROM=32K RAM=10K +stm32f103?8* stm32f1 ROM=64K RAM=20K +stm32f103?b* stm32f1 ROM=128K RAM=20K +stm32f103?c* stm32f1 ROM=256K RAM=48K +stm32f103?d* stm32f1 ROM=384K RAM=64K +stm32f103?e* stm32f1 ROM=512K RAM=64K +stm32f103?f* stm32f1 ROM=768K RAM=96K +stm32f103?g* stm32f1 ROM=1024K RAM=96K diff --git a/simple_cdc/ld/stm32f103x4.ld b/simple_cdc/ld/stm32f103x4.ld new file mode 100644 index 0000000..efed65e --- /dev/null +++ b/simple_cdc/ld/stm32f103x4.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 16K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 6K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103x6.ld b/simple_cdc/ld/stm32f103x6.ld new file mode 100644 index 0000000..13f05f9 --- /dev/null +++ b/simple_cdc/ld/stm32f103x6.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 32K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 10K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103x8.ld b/simple_cdc/ld/stm32f103x8.ld new file mode 100644 index 0000000..2c4640f --- /dev/null +++ b/simple_cdc/ld/stm32f103x8.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 64K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xB.ld b/simple_cdc/ld/stm32f103xB.ld new file mode 100644 index 0000000..138444d --- /dev/null +++ b/simple_cdc/ld/stm32f103xB.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xC.ld b/simple_cdc/ld/stm32f103xC.ld new file mode 100644 index 0000000..fda76bf --- /dev/null +++ b/simple_cdc/ld/stm32f103xC.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 256K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xD.ld b/simple_cdc/ld/stm32f103xD.ld new file mode 100644 index 0000000..0f996c2 --- /dev/null +++ b/simple_cdc/ld/stm32f103xD.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 384K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xE.ld b/simple_cdc/ld/stm32f103xE.ld new file mode 100644 index 0000000..b0fcb69 --- /dev/null +++ b/simple_cdc/ld/stm32f103xE.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xF.ld b/simple_cdc/ld/stm32f103xF.ld new file mode 100644 index 0000000..62d47db --- /dev/null +++ b/simple_cdc/ld/stm32f103xF.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 768K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/ld/stm32f103xG.ld b/simple_cdc/ld/stm32f103xG.ld new file mode 100644 index 0000000..0c0c968 --- /dev/null +++ b/simple_cdc/ld/stm32f103xG.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* Linker script for STM32F100x4, 16K flash, 4K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32f1.ld + diff --git a/simple_cdc/main.c b/simple_cdc/main.c new file mode 100644 index 0000000..af703fc --- /dev/null +++ b/simple_cdc/main.c @@ -0,0 +1,88 @@ +/* + * main.c + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include "main.h" +#include "hardware_ini.h" +#include "cdcacm.h" + +volatile uint32_t Timer = 0; // global timer (milliseconds) +usbd_device *usbd_dev; + +int main(){ + uint32_t Old_timer = 0; + + // RCC clocking: 8MHz oscillator -> 72MHz system + rcc_clock_setup_in_hse_8mhz_out_72mhz(); + + GPIO_init(); + + usb_disconnect(); // turn off USB while initializing all + + // USB + usbd_dev = USB_init(); + + // SysTick is a system timer with 1ms period + SysTick_init(); + + // wait a little and then turn on USB pullup +// for (i = 0; i < 0x800000; i++) +// __asm__("nop"); + + usb_connect(); // turn on USB + + while(1){ + usbd_poll(usbd_dev); + if(usbdatalen){ // there's something in USB buffer + usbdatalen = parce_incoming_buf(usbdatabuf, usbdatalen); + } + //check_and_parce_UART(USART1); // also check data in UART buffers + + if(Timer - Old_timer > 999){ // one-second cycle + Old_timer += 1000; + }else if(Timer < Old_timer){ // Timer overflow + Old_timer = 0; + } + } +} + + +/** + * SysTick interrupt: increment global time & send data buffer through USB + */ +void sys_tick_handler(){ + Timer++; + usbd_poll(usbd_dev); + usb_send_buffer(); +} + +// pause function, delay in ms +void Delay(uint16_t _U_ time){ + uint32_t waitto = Timer + time; + while(Timer < waitto); +} + +/** + * print current time in milliseconds: 4 bytes for ovrvlow + 4 bytes for time + * with ' ' as delimeter + */ +void print_time(){ + print_int(Timer); +} diff --git a/simple_cdc/main.h b/simple_cdc/main.h new file mode 100644 index 0000000..4de99af --- /dev/null +++ b/simple_cdc/main.h @@ -0,0 +1,54 @@ +/* + * main.h + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + + +#pragma once +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include +#include // memcpy +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ADC_CHANNELS_NUMBER (10) + +#include "sync.h" // mutexes +#include "user_proto.h" + +#define _U_ __attribute__((__unused__)) +#define U8(x) ((uint8_t) x) +#define U16(x) ((uint16_t) x) +#define U32(x) ((uint32_t) x) + +extern volatile uint32_t Timer; // global timer (milliseconds) +void Delay(uint16_t time); + +#endif // __MAIN_H__ + diff --git a/simple_cdc/mk/cdcacm.d b/simple_cdc/mk/cdcacm.d new file mode 100644 index 0000000..8ba75cf --- /dev/null +++ b/simple_cdc/mk/cdcacm.d @@ -0,0 +1,54 @@ +mk/cdcacm.o: cdcacm.c cdcacm.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbd.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbstd.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/newlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/config.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/ieeefp.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/features.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/common.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdbool.h user_proto.h main.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stddef.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/reent.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_default_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/lock.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/alloca.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/string.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/cdefs.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/string.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/gpio_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/dispatch/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/cdc.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/systick.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/rcc_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/adc_common_v1.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/dma_common_l1f013.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_l1f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_all.h \ + sync.h diff --git a/simple_cdc/mk/cdcacm.o b/simple_cdc/mk/cdcacm.o new file mode 100644 index 0000000..1da4f44 Binary files /dev/null and b/simple_cdc/mk/cdcacm.o differ diff --git a/simple_cdc/mk/hardware_ini.d b/simple_cdc/mk/hardware_ini.d new file mode 100644 index 0000000..449768e --- /dev/null +++ b/simple_cdc/mk/hardware_ini.d @@ -0,0 +1,54 @@ +mk/hardware_ini.o: hardware_ini.c main.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/ieeefp.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/newlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/config.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/features.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stddef.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/reent.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_default_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/lock.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/alloca.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/string.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/cdefs.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/string.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/common.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdbool.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/gpio_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/dispatch/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/cdc.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbd.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbstd.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/systick.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/rcc_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/adc_common_v1.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/dma_common_l1f013.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_l1f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_all.h \ + sync.h user_proto.h cdcacm.h hardware_ini.h diff --git a/simple_cdc/mk/hardware_ini.o b/simple_cdc/mk/hardware_ini.o new file mode 100644 index 0000000..f968db4 Binary files /dev/null and b/simple_cdc/mk/hardware_ini.o differ diff --git a/simple_cdc/mk/main.d b/simple_cdc/mk/main.d new file mode 100644 index 0000000..c4999b5 --- /dev/null +++ b/simple_cdc/mk/main.d @@ -0,0 +1,54 @@ +mk/main.o: main.c main.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/ieeefp.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/newlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/config.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/features.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stddef.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/reent.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_default_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/lock.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/alloca.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/string.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/cdefs.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/string.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/common.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdbool.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/gpio_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/dispatch/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/cdc.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbd.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbstd.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/systick.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/rcc_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/adc_common_v1.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/dma_common_l1f013.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_l1f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_all.h \ + sync.h user_proto.h cdcacm.h hardware_ini.h diff --git a/simple_cdc/mk/main.o b/simple_cdc/mk/main.o new file mode 100644 index 0000000..d2ded87 Binary files /dev/null and b/simple_cdc/mk/main.o differ diff --git a/simple_cdc/mk/sync.d b/simple_cdc/mk/sync.d new file mode 100644 index 0000000..01d017b --- /dev/null +++ b/simple_cdc/mk/sync.d @@ -0,0 +1,10 @@ +mk/sync.o: sync.c /usr/local/arm-none-eabi/include/libopencm3/cm3/sync.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/common.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/newlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/config.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/ieeefp.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/features.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdbool.h diff --git a/simple_cdc/mk/sync.o b/simple_cdc/mk/sync.o new file mode 100644 index 0000000..da11b9d Binary files /dev/null and b/simple_cdc/mk/sync.o differ diff --git a/simple_cdc/mk/usb_cdc_simple.elf b/simple_cdc/mk/usb_cdc_simple.elf new file mode 100755 index 0000000..7d7dbde Binary files /dev/null and b/simple_cdc/mk/usb_cdc_simple.elf differ diff --git a/simple_cdc/mk/usb_cdc_simple.map b/simple_cdc/mk/usb_cdc_simple.map new file mode 100644 index 0000000..69c83de --- /dev/null +++ b/simple_cdc/mk/usb_cdc_simple.map @@ -0,0 +1,985 @@ +Archive member included because of file (symbol) + +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + mk/main.o (rcc_clock_setup_in_hse_8mhz_out_72mhz) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + mk/hardware_ini.o (rcc_peripheral_enable_clock) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) (flash_set_ws) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + mk/cdcacm.o (usbd_init) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + mk/cdcacm.o (usbd_register_control_callback) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + mk/cdcacm.o (usbd_register_set_config_callback) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + mk/cdcacm.o (stm32f103_usb_driver) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + (reset_handler) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + mk/hardware_ini.o (systick_set_reload) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) (cm3_assert_failed) +/usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) (flash_get_status_flags) +/usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) (memcpy) +/usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) (strlen) + +Discarded input sections + + .text 0x0000000000000000 0x0 mk/user_proto.o + .data 0x0000000000000000 0x0 mk/user_proto.o + .bss 0x0000000000000000 0x0 mk/user_proto.o + .text.putc.5923 + 0x0000000000000000 0x10 mk/user_proto.o + .text.print_hex + 0x0000000000000000 0x30 mk/user_proto.o + .text 0x0000000000000000 0x0 mk/hardware_ini.o + .data 0x0000000000000000 0x0 mk/hardware_ini.o + .bss 0x0000000000000000 0x0 mk/hardware_ini.o + .text 0x0000000000000000 0x0 mk/cdcacm.o + .data 0x0000000000000000 0x0 mk/cdcacm.o + .bss 0x0000000000000000 0x0 mk/cdcacm.o + .text 0x0000000000000000 0x0 mk/sync.o + .data 0x0000000000000000 0x0 mk/sync.o + .bss 0x0000000000000000 0x0 mk/sync.o + .text.__dmb 0x0000000000000000 0x6 mk/sync.o + .text.__ldrex 0x0000000000000000 0x6 mk/sync.o + .text.__strex 0x0000000000000000 0x8 mk/sync.o + .text 0x0000000000000000 0x0 mk/main.o + .data 0x0000000000000000 0x0 mk/main.o + .bss 0x0000000000000000 0x0 mk/main.o + .text.Delay 0x0000000000000000 0x14 mk/main.o + .text.print_time + 0x0000000000000000 0xc mk/main.o + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_ready_int_clear + 0x0000000000000000 0x5c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_ready_int_enable + 0x0000000000000000 0x5c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_ready_int_disable + 0x0000000000000000 0x5c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_ready_int_flag + 0x0000000000000000 0x54 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_css_int_clear + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_css_int_flag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_off + 0x0000000000000000 0x58 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_css_enable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_css_disable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_bypass_enable + 0x0000000000000000 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_osc_bypass_disable + 0x0000000000000000 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_pll2_multiplication_factor + 0x0000000000000000 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_pll3_multiplication_factor + 0x0000000000000000 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_usbpre + 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_prediv1 + 0x0000000000000000 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_prediv2 + 0x0000000000000000 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_prediv1_source + 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_set_mco + 0x0000000000000000 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_system_clock_source + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hsi_out_64mhz + 0x0000000000000000 0x6c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hsi_out_48mhz + 0x0000000000000000 0x7c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hsi_out_24mhz + 0x0000000000000000 0x68 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hse_8mhz_out_24mhz + 0x0000000000000000 0x80 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hse_12mhz_out_72mhz + 0x0000000000000000 0x84 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hse_16mhz_out_72mhz + 0x0000000000000000 0x84 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_clock_setup_in_hse_25mhz_out_72mhz + 0x0000000000000000 0x9c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_backupdomain_reset + 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_peripheral_disable_clock + 0x0000000000000000 0xa /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_peripheral_reset + 0x0000000000000000 0x8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_peripheral_clear_reset + 0x0000000000000000 0xa /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_periph_clock_enable + 0x0000000000000000 0x1c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_periph_clock_disable + 0x0000000000000000 0x1e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_periph_reset_pulse + 0x0000000000000000 0x24 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_periph_reset_hold + 0x0000000000000000 0x1c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text.rcc_periph_reset_release + 0x0000000000000000 0x1e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_prefetch_buffer_enable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_prefetch_buffer_disable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_unlock + 0x0000000000000000 0x24 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_lock + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_clear_pgerr_flag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_clear_eop_flag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_clear_wrprterr_flag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_clear_bsy_flag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_wait_for_last_operation + 0x0000000000000000 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_program_word + 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_unlock_option_bytes + 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_erase_option_bytes + 0x0000000000000000 0x34 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text.flash_program_option_bytes + 0x0000000000000000 0x34 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_register_reset_callback + 0x0000000000000000 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_register_suspend_callback + 0x0000000000000000 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_register_resume_callback + 0x0000000000000000 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_register_sof_callback + 0x0000000000000000 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_disconnect + 0x0000000000000000 0xe /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text.usbd_ep_nak_set + 0x0000000000000000 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_get_reload + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_get_value + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_set_frequency + 0x0000000000000000 0x3c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_interrupt_disable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_counter_disable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_get_countflag + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_clear + 0x0000000000000000 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text.systick_get_calib + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .text.cm3_assert_failed + 0x0000000000000000 0x2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .text.cm3_assert_failed_verbose + 0x0000000000000000 0x6 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_info 0x0000000000000000 0xf7 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_abbrev 0x0000000000000000 0x88 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_loc 0x0000000000000000 0xa4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_aranges + 0x0000000000000000 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_ranges 0x0000000000000000 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_line 0x0000000000000000 0x53 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_str 0x0000000000000000 0x110 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .ARM.attributes + 0x0000000000000000 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .debug_frame 0x0000000000000000 0x38 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(assert.o) + .text 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .data 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .bss 0x0000000000000000 0x0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_halfcycle_enable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_halfcycle_disable + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_unlock_upper + 0x0000000000000000 0x30 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_lock_upper + 0x0000000000000000 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_clear_pgerr_flag_upper + 0x0000000000000000 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_clear_eop_flag_upper + 0x0000000000000000 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_clear_wrprterr_flag_upper + 0x0000000000000000 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_clear_bsy_flag_upper + 0x0000000000000000 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_clear_status_flags + 0x0000000000000000 0x38 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_get_status_flags + 0x0000000000000000 0x2c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_program_half_word + 0x0000000000000000 0x60 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_erase_page + 0x0000000000000000 0x78 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .text.flash_erase_all_pages + 0x0000000000000000 0x48 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_info 0x0000000000000000 0x2af /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_abbrev 0x0000000000000000 0xf8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_loc 0x0000000000000000 0xdd /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_aranges + 0x0000000000000000 0x80 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_ranges 0x0000000000000000 0x70 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_line 0x0000000000000000 0x1e2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_str 0x0000000000000000 0x299 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .ARM.attributes + 0x0000000000000000 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .debug_frame 0x0000000000000000 0x104 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash.o) + .data 0x0000000000000000 0x0 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .bss 0x0000000000000000 0x0 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .data 0x0000000000000000 0x0 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + .bss 0x0000000000000000 0x0 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +Memory Configuration + +Name Origin Length Attributes +rom 0x0000000008000000 0x0000000000020000 xr +ram 0x0000000020000000 0x0000000000005000 xrw +*default* 0x0000000000000000 0xffffffffffffffff + +Linker script and memory map + +LOAD mk/user_proto.o +LOAD mk/hardware_ini.o +LOAD mk/cdcacm.o +LOAD mk/sync.o +LOAD mk/main.o +LOAD /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a +START GROUP +LOAD /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a +LOAD /usr/lib/gcc/arm-none-eabi/4.7.3/thumb/libgcc.a +END GROUP +START GROUP +LOAD /usr/lib/gcc/arm-none-eabi/4.7.3/thumb/libgcc.a +LOAD /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a +END GROUP + +.text 0x0000000008000000 0x181c + *(.vectors) + .vectors 0x0000000008000000 0x150 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + 0x0000000008000000 vector_table + *(.text*) + .text.prnt 0x0000000008000150 0x16 mk/user_proto.o + 0x0000000008000150 prnt + *fill* 0x0000000008000166 0x2 + .text.help 0x0000000008000168 0x24 mk/user_proto.o + 0x0000000008000168 help + .text.read_int + 0x000000000800018c 0xb4 mk/user_proto.o + 0x000000000800018c read_int + .text.print_int + 0x0000000008000240 0x5c mk/user_proto.o + 0x0000000008000240 print_int + .text.parce_incoming_buf + 0x000000000800029c 0xb4 mk/user_proto.o + 0x000000000800029c parce_incoming_buf + .text.show_int + 0x0000000008000350 0x10 mk/user_proto.o + 0x0000000008000350 show_int + .text.GPIO_init + 0x0000000008000360 0xc mk/hardware_ini.o + 0x0000000008000360 GPIO_init + .text.SysTick_init + 0x000000000800036c 0x1c mk/hardware_ini.o + 0x000000000800036c SysTick_init + .text.cdcacm_set_config + 0x0000000008000388 0x50 mk/cdcacm.o + .text.cdcacm_data_rx_cb + 0x00000000080003d8 0x30 mk/cdcacm.o + .text.cdcacm_control_request + 0x0000000008000408 0xa0 mk/cdcacm.o + .text.USB_init + 0x00000000080004a8 0x4c mk/cdcacm.o + 0x00000000080004a8 USB_init + .text.usb_send_buffer + 0x00000000080004f4 0x64 mk/cdcacm.o + 0x00000000080004f4 usb_send_buffer + .text.usb_send + 0x0000000008000558 0x38 mk/cdcacm.o + 0x0000000008000558 usb_send + .text.cdcacm_data_tx_cb + 0x0000000008000590 0x4 mk/cdcacm.o + .text.mutex_lock + 0x0000000008000594 0x18 mk/sync.o + 0x0000000008000594 mutex_lock + .text.mutex_unlock + 0x00000000080005ac 0xa mk/sync.o + 0x00000000080005ac mutex_unlock + .text.mutex_trylock + 0x00000000080005b6 0x18 mk/sync.o + 0x00000000080005b6 mutex_trylock + *fill* 0x00000000080005ce 0x2 + .text.startup.main + 0x00000000080005d0 0x5c mk/main.o + 0x00000000080005d0 main + .text.sys_tick_handler + 0x000000000800062c 0x24 mk/main.o + 0x000000000800062c sys_tick_handler + .text.rcc_osc_on.part.0 + 0x0000000008000650 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .text.rcc_wait_for_osc_ready + 0x0000000008000660 0x64 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000660 rcc_wait_for_osc_ready + .text.rcc_osc_on + 0x00000000080006c4 0x54 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x00000000080006c4 rcc_osc_on + .text.rcc_set_sysclk_source + 0x0000000008000718 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000718 rcc_set_sysclk_source + .text.rcc_set_pll_multiplication_factor + 0x000000000800072c 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x000000000800072c rcc_set_pll_multiplication_factor + .text.rcc_set_pll_source + 0x0000000008000740 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000740 rcc_set_pll_source + .text.rcc_set_pllxtpre + 0x0000000008000754 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000754 rcc_set_pllxtpre + .text.rcc_set_adcpre + 0x0000000008000768 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000768 rcc_set_adcpre + .text.rcc_set_ppre2 + 0x000000000800077c 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x000000000800077c rcc_set_ppre2 + .text.rcc_set_ppre1 + 0x0000000008000790 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000008000790 rcc_set_ppre1 + .text.rcc_set_hpre + 0x00000000080007a4 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x00000000080007a4 rcc_set_hpre + .text.rcc_clock_setup_in_hse_8mhz_out_72mhz + 0x00000000080007b8 0x84 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x00000000080007b8 rcc_clock_setup_in_hse_8mhz_out_72mhz + .text.rcc_peripheral_enable_clock + 0x000000000800083c 0x8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + 0x000000000800083c rcc_peripheral_enable_clock + .text.flash_set_ws + 0x0000000008000844 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + 0x0000000008000844 flash_set_ws + .text.usbd_init + 0x0000000008000858 0x44 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x0000000008000858 usbd_init + .text.usbd_poll + 0x000000000800089c 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x000000000800089c usbd_poll + .text.usbd_ep_setup + 0x00000000080008a8 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x00000000080008a8 usbd_ep_setup + .text._usbd_reset + 0x00000000080008b8 0x2a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x00000000080008b8 _usbd_reset + .text.usbd_ep_write_packet + 0x00000000080008e2 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x00000000080008e2 usbd_ep_write_packet + .text.usbd_ep_read_packet + 0x00000000080008ee 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x00000000080008ee usbd_ep_read_packet + .text.usbd_ep_stall_set + 0x00000000080008fa 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x00000000080008fa usbd_ep_stall_set + .text.usbd_ep_stall_get + 0x0000000008000906 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x0000000008000906 usbd_ep_stall_get + .text.usb_control_send_chunk + 0x0000000008000912 0x44 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text.stall_transaction + 0x0000000008000956 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text.usb_control_recv_chunk + 0x000000000800096a 0x3c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text.usb_control_request_dispatch + 0x00000000080009a6 0x66 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text.usb_control_setup_read + 0x0000000008000a0c 0x40 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .text.usbd_register_control_callback + 0x0000000008000a4c 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + 0x0000000008000a4c usbd_register_control_callback + .text._usbd_control_setup + 0x0000000008000a74 0x5e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + 0x0000000008000a74 _usbd_control_setup + .text._usbd_control_out + 0x0000000008000ad2 0x86 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + 0x0000000008000ad2 _usbd_control_out + .text._usbd_control_in + 0x0000000008000b58 0x56 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + 0x0000000008000b58 _usbd_control_in + .text.usb_standard_get_configuration + 0x0000000008000bae 0x14 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_set_interface + 0x0000000008000bc2 0xe /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_get_interface + 0x0000000008000bd0 0xc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_device_get_status + 0x0000000008000bdc 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_interface_get_status + 0x0000000008000bf4 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_endpoint_get_status + 0x0000000008000c0c 0x2a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_endpoint_stall + 0x0000000008000c36 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_endpoint_unstall + 0x0000000008000c46 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_get_descriptor + 0x0000000008000c56 0x23c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_set_address + 0x0000000008000e92 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usb_standard_set_configuration + 0x0000000008000eba 0x3e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .text.usbd_register_set_config_callback + 0x0000000008000ef8 0x24 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x0000000008000ef8 usbd_register_set_config_callback + .text._usbd_standard_request_device + 0x0000000008000f1c 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x0000000008000f1c _usbd_standard_request_device + .text._usbd_standard_request_interface + 0x0000000008000f3c 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x0000000008000f3c _usbd_standard_request_interface + .text._usbd_standard_request_endpoint + 0x0000000008000f5c 0x38 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x0000000008000f5c _usbd_standard_request_endpoint + .text._usbd_standard_request + 0x0000000008000f94 0x36 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x0000000008000f94 _usbd_standard_request + *fill* 0x0000000008000fca 0x2 + .text.stm32f103_set_address + 0x0000000008000fcc 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_endpoints_reset + 0x0000000008000fdc 0x34 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_ep_stall_set + 0x0000000008001010 0xbc /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_ep_stall_get + 0x00000000080010cc 0x3a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + *fill* 0x0000000008001106 0x2 + .text.stm32f103_ep_write_packet + 0x0000000008001108 0x90 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_ep_read_packet + 0x0000000008001198 0xd8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_poll + 0x0000000008001270 0xb4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_usbd_init + 0x0000000008001324 0x34 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_ep_setup + 0x0000000008001358 0x168 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.stm32f103_ep_nak_set + 0x00000000080014c0 0x5c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .text.blocking_handler + 0x000000000800151c 0x2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + 0x000000000800151c usart3_isr + 0x000000000800151c rtc_isr + 0x000000000800151c tim7_isr + 0x000000000800151c adc1_2_isr + 0x000000000800151c tim1_trg_com_isr + 0x000000000800151c usb_hp_can_tx_isr + 0x000000000800151c tim6_isr + 0x000000000800151c usb_wakeup_isr + 0x000000000800151c blocking_handler + 0x000000000800151c tim5_isr + 0x000000000800151c otg_fs_isr + 0x000000000800151c spi1_isr + 0x000000000800151c dma1_channel6_isr + 0x000000000800151c exti2_isr + 0x000000000800151c can_rx1_isr + 0x000000000800151c dma1_channel5_isr + 0x000000000800151c dma2_channel5_isr + 0x000000000800151c usart1_isr + 0x000000000800151c usage_fault_handler + 0x000000000800151c tim8_trg_com_isr + 0x000000000800151c can2_rx0_isr + 0x000000000800151c tim1_brk_isr + 0x000000000800151c can2_rx1_isr + 0x000000000800151c tim1_cc_isr + 0x000000000800151c sdio_isr + 0x000000000800151c eth_isr + 0x000000000800151c dma1_channel4_isr + 0x000000000800151c tim8_brk_isr + 0x000000000800151c dma2_channel4_5_isr + 0x000000000800151c pvd_isr + 0x000000000800151c rcc_isr + 0x000000000800151c flash_isr + 0x000000000800151c uart4_isr + 0x000000000800151c rtc_alarm_isr + 0x000000000800151c exti15_10_isr + 0x000000000800151c hard_fault_handler + 0x000000000800151c exti1_isr + 0x000000000800151c i2c1_ev_isr + 0x000000000800151c dma2_channel1_isr + 0x000000000800151c spi2_isr + 0x000000000800151c tim8_up_isr + 0x000000000800151c dma2_channel2_isr + 0x000000000800151c adc3_isr + 0x000000000800151c exti3_isr + 0x000000000800151c tim3_isr + 0x000000000800151c usart2_isr + 0x000000000800151c usb_lp_can_rx0_isr + 0x000000000800151c i2c2_er_isr + 0x000000000800151c i2c2_ev_isr + 0x000000000800151c uart5_isr + 0x000000000800151c fsmc_isr + 0x000000000800151c dma1_channel1_isr + 0x000000000800151c exti4_isr + 0x000000000800151c mem_manage_handler + 0x000000000800151c can2_tx_isr + 0x000000000800151c exti9_5_isr + 0x000000000800151c dma2_channel3_isr + 0x000000000800151c dma1_channel7_isr + 0x000000000800151c tim1_up_isr + 0x000000000800151c can2_sce_isr + 0x000000000800151c tim4_isr + 0x000000000800151c dma1_channel2_isr + 0x000000000800151c i2c1_er_isr + 0x000000000800151c can_sce_isr + 0x000000000800151c tim8_cc_isr + 0x000000000800151c tamper_isr + 0x000000000800151c eth_wkup_isr + 0x000000000800151c bus_fault_handler + 0x000000000800151c wwdg_isr + 0x000000000800151c dma1_channel3_isr + 0x000000000800151c spi3_isr + 0x000000000800151c tim2_isr + 0x000000000800151c exti0_isr + .text.null_handler + 0x000000000800151e 0x2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + 0x000000000800151e null_handler + 0x000000000800151e sv_call_handler + 0x000000000800151e pend_sv_handler + 0x000000000800151e debug_monitor_handler + 0x000000000800151e nmi_handler + .text.reset_handler + 0x0000000008001520 0x84 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + 0x0000000008001520 reset_handler + .text.systick_set_reload + 0x00000000080015a4 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + 0x00000000080015a4 systick_set_reload + .text.systick_set_clocksource + 0x00000000080015b4 0x18 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + 0x00000000080015b4 systick_set_clocksource + .text.systick_interrupt_enable + 0x00000000080015cc 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + 0x00000000080015cc systick_interrupt_enable + .text.systick_counter_enable + 0x00000000080015dc 0x10 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + 0x00000000080015dc systick_counter_enable + .text 0x00000000080015ec 0x90 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + 0x00000000080015ec memcpy + .text 0x000000000800167c 0x10 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + 0x000000000800167c strlen + 0x000000000800168c . = ALIGN (0x4) + *(.rodata*) + .rodata.str1.1 + 0x000000000800168c 0x4e mk/user_proto.o + .rodata.dev 0x00000000080016da 0x12 mk/cdcacm.o + .rodata.data_endp + 0x00000000080016ec 0xe mk/cdcacm.o + .rodata.config + 0x00000000080016fa 0xd mk/cdcacm.o + *fill* 0x0000000008001707 0x1 + .rodata.ifaces + 0x0000000008001708 0x18 mk/cdcacm.o + .rodata.comm_iface + 0x0000000008001720 0x15 mk/cdcacm.o + .rodata.str1.1 + 0x0000000008001735 0x24 mk/cdcacm.o + .rodata.data_iface + 0x0000000008001759 0x15 mk/cdcacm.o + .rodata.comm_endp + 0x000000000800176e 0x7 mk/cdcacm.o + .rodata.cdcacm_functional_descriptors + 0x0000000008001775 0x13 mk/cdcacm.o + .rodata.CSWTCH.22 + 0x0000000008001788 0x30 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .rodata.CSWTCH.19 + 0x00000000080017b8 0x28 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .rodata 0x00000000080017e0 0x8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .rodata.stm32f103_usb_driver + 0x00000000080017e8 0x34 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + 0x00000000080017e8 stm32f103_usb_driver + 0x000000000800181c . = ALIGN (0x4) + +.glue_7 0x000000000800181c 0x0 + .glue_7 0x0000000000000000 0x0 linker stubs + +.glue_7t 0x000000000800181c 0x0 + .glue_7t 0x0000000000000000 0x0 linker stubs + +.vfp11_veneer 0x000000000800181c 0x0 + .vfp11_veneer 0x0000000000000000 0x0 linker stubs + +.v4_bx 0x000000000800181c 0x0 + .v4_bx 0x0000000000000000 0x0 linker stubs + +.iplt 0x000000000800181c 0x0 + .iplt 0x0000000000000000 0x0 mk/user_proto.o + +.rel.dyn 0x000000000800181c 0x0 + .rel.iplt 0x0000000000000000 0x0 mk/user_proto.o + +.preinit_array 0x000000000800181c 0x0 + 0x000000000800181c . = ALIGN (0x4) + 0x000000000800181c __preinit_array_start = . + *(.preinit_array) + 0x000000000800181c __preinit_array_end = . + +.init_array 0x000000000800181c 0x0 + 0x000000000800181c . = ALIGN (0x4) + 0x000000000800181c __init_array_start = . + *(SORT(.init_array.*)) + *(.init_array) + 0x000000000800181c __init_array_end = . + +.fini_array 0x000000000800181c 0x0 + 0x000000000800181c . = ALIGN (0x4) + 0x000000000800181c __fini_array_start = . + *(.fini_array) + *(SORT(.fini_array.*)) + 0x000000000800181c __fini_array_end = . + +.ARM.extab + *(.ARM.extab*) + +.ARM.exidx 0x000000000800181c 0x0 + 0x000000000800181c __exidx_start = . + *(.ARM.exidx*) + 0x000000000800181c __exidx_end = . + 0x000000000800181c . = ALIGN (0x4) + 0x000000000800181c _etext = . + +.data 0x0000000020000000 0x1c load address 0x000000000800181c + 0x0000000020000000 _data = . + *(.data*) + .data.Uval_ready + 0x0000000020000000 0x1 mk/user_proto.o + 0x0000000020000000 Uval_ready + .data.linecoding + 0x0000000020000001 0x7 mk/cdcacm.o + 0x0000000020000001 linecoding + .data.usb_strings + 0x0000000020000008 0xc mk/cdcacm.o + .data.rcc_ppre1_frequency + 0x0000000020000014 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000020000014 rcc_ppre1_frequency + .data.rcc_ppre2_frequency + 0x0000000020000018 0x4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x0000000020000018 rcc_ppre2_frequency + 0x000000002000001c . = ALIGN (0x4) + 0x000000002000001c _edata = . + 0x000000000800181c _data_loadaddr = LOADADDR (.data) + +.igot.plt 0x000000002000001c 0x0 load address 0x0000000008001838 + .igot.plt 0x0000000000000000 0x0 mk/user_proto.o + +.bss 0x000000002000001c 0x224 load address 0x0000000008001838 + *(.bss*) + .bss.User_value + 0x000000002000001c 0x4 mk/user_proto.o + .bss.sign.5912 + 0x0000000020000020 0x4 mk/user_proto.o + .bss.enteredDigits.5911 + 0x0000000020000024 0x4 mk/user_proto.o + .bss.I 0x0000000020000028 0x4 mk/user_proto.o + 0x0000000020000028 I + .bss.usbd_control_buffer + 0x000000002000002c 0x80 mk/cdcacm.o + 0x000000002000002c usbd_control_buffer + .bss.send_block_mutex + 0x00000000200000ac 0x4 mk/cdcacm.o + 0x00000000200000ac send_block_mutex + .bss.usbdatalen + 0x00000000200000b0 0x4 mk/cdcacm.o + 0x00000000200000b0 usbdatalen + .bss.USB_Tx_ptr + 0x00000000200000b4 0x1 mk/cdcacm.o + .bss.usbdatabuf + 0x00000000200000b5 0x40 mk/cdcacm.o + 0x00000000200000b5 usbdatabuf + .bss.USB_connected + 0x00000000200000f5 0x1 mk/cdcacm.o + 0x00000000200000f5 USB_connected + .bss.USB_Tx_Buffer + 0x00000000200000f6 0x40 mk/cdcacm.o + *fill* 0x0000000020000136 0x2 + .bss.current_usb + 0x0000000020000138 0x4 mk/cdcacm.o + .bss.usbd_dev 0x000000002000013c 0x4 mk/main.o + 0x000000002000013c usbd_dev + .bss.Timer 0x0000000020000140 0x4 mk/main.o + 0x0000000020000140 Timer + .bss.usbd_dev 0x0000000020000144 0xf4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .bss.force_nak + 0x0000000020000238 0x8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + *(COMMON) + 0x0000000020000240 . = ALIGN (0x4) + 0x0000000020000240 _ebss = . + +/DISCARD/ + *(.eh_frame) + 0x0000000020000240 . = ALIGN (0x4) + 0x0000000020000240 end = . + 0x0000000020005000 PROVIDE (_stack, (ORIGIN (ram) + 0x5000)) +OUTPUT(mk/usb_cdc_simple.elf elf32-littlearm) + +.debug_info 0x0000000000000000 0x7c7e + .debug_info 0x0000000000000000 0x51e mk/user_proto.o + .debug_info 0x000000000000051e 0x17c mk/hardware_ini.o + .debug_info 0x000000000000069a 0xed4 mk/cdcacm.o + .debug_info 0x000000000000156e 0x2eb mk/sync.o + .debug_info 0x0000000000001859 0x280 mk/main.o + .debug_info 0x0000000000001ad9 0xfff /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_info 0x0000000000002ad8 0x52e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_info 0x0000000000003006 0x2a8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_info 0x00000000000032ae 0xe20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_info 0x00000000000040ce 0xf22 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_info 0x0000000000004ff0 0x148a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_info 0x000000000000647a 0x1105 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_info 0x000000000000757f 0x2d2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_info 0x0000000000007851 0x22e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_info 0x0000000000007a7f 0x132 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_info 0x0000000000007bb1 0xcd /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_abbrev 0x0000000000000000 0x1dae + .debug_abbrev 0x0000000000000000 0x28b mk/user_proto.o + .debug_abbrev 0x000000000000028b 0xe4 mk/hardware_ini.o + .debug_abbrev 0x000000000000036f 0x337 mk/cdcacm.o + .debug_abbrev 0x00000000000006a6 0x196 mk/sync.o + .debug_abbrev 0x000000000000083c 0x1a8 mk/main.o + .debug_abbrev 0x00000000000009e4 0x281 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_abbrev 0x0000000000000c65 0xc0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_abbrev 0x0000000000000d25 0x100 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_abbrev 0x0000000000000e25 0x1ec /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_abbrev 0x0000000000001011 0x316 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_abbrev 0x0000000000001327 0x37e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_abbrev 0x00000000000016a5 0x387 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_abbrev 0x0000000000001a2c 0x12a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_abbrev 0x0000000000001b56 0x125 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_abbrev 0x0000000000001c7b 0xa9 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_abbrev 0x0000000000001d24 0x8a /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_loc 0x0000000000000000 0x379e + .debug_loc 0x0000000000000000 0x3de mk/user_proto.o + .debug_loc 0x00000000000003de 0x20 mk/hardware_ini.o + .debug_loc 0x00000000000003fe 0x3f9 mk/cdcacm.o + .debug_loc 0x00000000000007f7 0xd2 mk/sync.o + .debug_loc 0x00000000000008c9 0x80 mk/main.o + .debug_loc 0x0000000000000949 0x40e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_loc 0x0000000000000d57 0x129 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_loc 0x0000000000000e80 0x11c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_loc 0x0000000000000f9c 0x4cd /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_loc 0x0000000000001469 0x4fd /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_loc 0x0000000000001966 0x102a /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_loc 0x0000000000002990 0x99e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_loc 0x000000000000332e 0xe9 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_loc 0x0000000000003417 0x12c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_loc 0x0000000000003543 0x23a /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_loc 0x000000000000377d 0x21 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_aranges 0x0000000000000000 0x658 + .debug_aranges + 0x0000000000000000 0x58 mk/user_proto.o + .debug_aranges + 0x0000000000000058 0x28 mk/hardware_ini.o + .debug_aranges + 0x0000000000000080 0x50 mk/cdcacm.o + .debug_aranges + 0x00000000000000d0 0x48 mk/sync.o + .debug_aranges + 0x0000000000000118 0x38 mk/main.o + .debug_aranges + 0x0000000000000150 0x150 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_aranges + 0x00000000000002a0 0x60 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_aranges + 0x0000000000000300 0x88 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_aranges + 0x0000000000000388 0x88 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_aranges + 0x0000000000000410 0x60 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_aranges + 0x0000000000000470 0x98 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_aranges + 0x0000000000000508 0x68 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_aranges + 0x0000000000000570 0x30 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_aranges + 0x00000000000005a0 0x78 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_aranges + 0x0000000000000618 0x20 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_aranges + 0x0000000000000638 0x20 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_ranges 0x0000000000000000 0x7d8 + .debug_ranges 0x0000000000000000 0x48 mk/user_proto.o + .debug_ranges 0x0000000000000048 0x18 mk/hardware_ini.o + .debug_ranges 0x0000000000000060 0x70 mk/cdcacm.o + .debug_ranges 0x00000000000000d0 0x68 mk/sync.o + .debug_ranges 0x0000000000000138 0x28 mk/main.o + .debug_ranges 0x0000000000000160 0x1b8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_ranges 0x0000000000000318 0x50 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_ranges 0x0000000000000368 0x78 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_ranges 0x00000000000003e0 0x78 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_ranges 0x0000000000000458 0x50 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_ranges 0x00000000000004a8 0xf0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_ranges 0x0000000000000598 0x1b8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_ranges 0x0000000000000750 0x20 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_ranges 0x0000000000000770 0x68 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + +.debug_line 0x0000000000000000 0x1ed5 + .debug_line 0x0000000000000000 0x1ac mk/user_proto.o + .debug_line 0x00000000000001ac 0x132 mk/hardware_ini.o + .debug_line 0x00000000000002de 0x197 mk/cdcacm.o + .debug_line 0x0000000000000475 0x13f mk/sync.o + .debug_line 0x00000000000005b4 0x183 mk/main.o + .debug_line 0x0000000000000737 0x493 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_line 0x0000000000000bca 0x150 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_line 0x0000000000000d1a 0x1d5 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_line 0x0000000000000eef 0x1d3 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_line 0x00000000000010c2 0x203 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_line 0x00000000000012c5 0x344 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_line 0x0000000000001609 0x381 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_line 0x000000000000198a 0x100 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_line 0x0000000000001a8a 0x168 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_line 0x0000000000001bf2 0x1ac /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_line 0x0000000000001d9e 0x137 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_str 0x0000000000000000 0x201b + .debug_str 0x0000000000000000 0x17d mk/user_proto.o + 0x1be (size before relaxing) + .debug_str 0x000000000000017d 0x9d mk/hardware_ini.o + 0x18a (size before relaxing) + .debug_str 0x000000000000021a 0x778 mk/cdcacm.o + 0x8cd (size before relaxing) + .debug_str 0x0000000000000992 0x26 mk/sync.o + 0x137 (size before relaxing) + .debug_str 0x00000000000009b8 0x60 mk/main.o + 0x1f5 (size before relaxing) + .debug_str 0x0000000000000a18 0x3f4 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + 0x4db (size before relaxing) + .debug_str 0x0000000000000e0c 0x4f1 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + 0x5df (size before relaxing) + .debug_str 0x00000000000012fd 0x179 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + 0x256 (size before relaxing) + .debug_str 0x0000000000001476 0x30f /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + 0x868 (size before relaxing) + .debug_str 0x0000000000001785 0x157 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + 0x85a (size before relaxing) + .debug_str 0x00000000000018dc 0x285 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + 0x9f3 (size before relaxing) + .debug_str 0x0000000000001b61 0x155 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + 0x89e (size before relaxing) + .debug_str 0x0000000000001cb6 0x1a5 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + 0x270 (size before relaxing) + .debug_str 0x0000000000001e5b 0xc2 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + 0x1f7 (size before relaxing) + .debug_str 0x0000000000001f1d 0x91 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + 0x13d (size before relaxing) + .debug_str 0x0000000000001fae 0x6d /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + 0x119 (size before relaxing) + +.comment 0x0000000000000000 0x2d + .comment 0x0000000000000000 0x2d mk/user_proto.o + 0x2e (size before relaxing) + .comment 0x0000000000000000 0x2e mk/hardware_ini.o + .comment 0x0000000000000000 0x2e mk/cdcacm.o + .comment 0x0000000000000000 0x2e mk/sync.o + .comment 0x0000000000000000 0x2e mk/main.o + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .comment 0x0000000000000000 0x2e /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .comment 0x0000000000000000 0x2e /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .comment 0x0000000000000000 0x2e /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.ARM.attributes + 0x0000000000000000 0x35 + .ARM.attributes + 0x0000000000000000 0x33 mk/user_proto.o + .ARM.attributes + 0x0000000000000033 0x33 mk/hardware_ini.o + .ARM.attributes + 0x0000000000000066 0x33 mk/cdcacm.o + .ARM.attributes + 0x0000000000000099 0x33 mk/sync.o + .ARM.attributes + 0x00000000000000cc 0x33 mk/main.o + .ARM.attributes + 0x00000000000000ff 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .ARM.attributes + 0x0000000000000132 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .ARM.attributes + 0x0000000000000165 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .ARM.attributes + 0x0000000000000198 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .ARM.attributes + 0x00000000000001cb 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .ARM.attributes + 0x00000000000001fe 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .ARM.attributes + 0x0000000000000231 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .ARM.attributes + 0x0000000000000264 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .ARM.attributes + 0x0000000000000297 0x33 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .ARM.attributes + 0x00000000000002ca 0x30 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .ARM.attributes + 0x00000000000002fa 0x30 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) + +.debug_frame 0x0000000000000000 0xdb0 + .debug_frame 0x0000000000000000 0xe8 mk/user_proto.o + .debug_frame 0x00000000000000e8 0x38 mk/hardware_ini.o + .debug_frame 0x0000000000000120 0xd0 mk/cdcacm.o + .debug_frame 0x00000000000001f0 0x70 mk/sync.o + .debug_frame 0x0000000000000260 0x68 mk/main.o + .debug_frame 0x00000000000002c8 0x2c8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc.o) + .debug_frame 0x0000000000000590 0xa0 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(rcc_common_all.o) + .debug_frame 0x0000000000000630 0x118 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(flash_common_f01.o) + .debug_frame 0x0000000000000748 0x158 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb.o) + .debug_frame 0x00000000000008a0 0x108 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_control.o) + .debug_frame 0x00000000000009a8 0x184 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_standard.o) + .debug_frame 0x0000000000000b2c 0x11c /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(usb_f103.o) + .debug_frame 0x0000000000000c48 0x40 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(vector.o) + .debug_frame 0x0000000000000c88 0xd8 /usr/local/arm-none-eabi/lib/libopencm3_stm32f1.a(systick.o) + .debug_frame 0x0000000000000d60 0x30 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-memcpy-stub.o) + .debug_frame 0x0000000000000d90 0x20 /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/thumb/libc.a(lib_a-strlen.o) diff --git a/simple_cdc/mk/user_proto.d b/simple_cdc/mk/user_proto.d new file mode 100644 index 0000000..c86f44e --- /dev/null +++ b/simple_cdc/mk/user_proto.d @@ -0,0 +1,54 @@ +mk/user_proto.o: user_proto.c cdcacm.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbd.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/usbstd.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdint.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/newlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/config.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/ieeefp.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/features.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/common.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stdbool.h main.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/_ansi.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/include/stddef.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/reent.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/_default_types.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/lock.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/machine/stdlib.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/alloca.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/string.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/cdefs.h \ + /usr/lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/include/sys/string.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/memorymap.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/gpio.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/gpio_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/usart.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/usart_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/dispatch/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/nvic.h \ + /usr/local/arm-none-eabi/include/libopencm3/usb/cdc.h \ + /usr/local/arm-none-eabi/include/libopencm3/cm3/systick.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/rcc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/rcc_common_all.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/adc.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/adc_common_v1.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/dma.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/dma_common_l1f013.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/f1/spi.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_l1f124.h \ + /usr/local/arm-none-eabi/include/libopencm3/stm32/common/spi_common_all.h \ + sync.h user_proto.h hardware_ini.h diff --git a/simple_cdc/mk/user_proto.o b/simple_cdc/mk/user_proto.o new file mode 100644 index 0000000..9dcec55 Binary files /dev/null and b/simple_cdc/mk/user_proto.o differ diff --git a/simple_cdc/sync.c b/simple_cdc/sync.c new file mode 100644 index 0000000..ba688c3 --- /dev/null +++ b/simple_cdc/sync.c @@ -0,0 +1,93 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Fergus Noble + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +/* + * TODO: + * implement mutexes for other type of MCU (which doesn't have strex & ldrex) + */ + +#include + +/* DMB is supported on CM0 */ +void __dmb() +{ + __asm__ volatile ("dmb"); +} + +/* Those are defined only on CM3 or CM4 */ +#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) + +uint32_t __ldrex(volatile uint32_t *addr) +{ + uint32_t res; + __asm__ volatile ("ldrex %0, [%1]" : "=r" (res) : "r" (addr)); + return res; +} + +uint32_t __strex(uint32_t val, volatile uint32_t *addr) +{ + uint32_t res; + __asm__ volatile ("strex %0, %2, [%1]" + : "=&r" (res) : "r" (addr), "r" (val)); + return res; +} + +void mutex_lock(mutex_t *m) +{ + uint32_t status = 0; + + do { + /* Wait until the mutex is unlocked. */ + while (__ldrex(m) != MUTEX_UNLOCKED); + + /* Try to acquire it. */ + status = __strex(MUTEX_LOCKED, m); + + /* Did we get it? If not then try again. */ + } while (status != 0); + + /* Execute the mysterious Data Memory Barrier instruction! */ + __dmb(); +} + +void mutex_unlock(mutex_t *m) +{ + /* Ensure accesses to protected resource are finished */ + __dmb(); + + /* Free the lock. */ + *m = MUTEX_UNLOCKED; +} + +/* + * Try to lock mutex + * if it's already locked or there was error in STREX, return MUTEX_LOCKED + * else return MUTEX_UNLOCKED + */ +mutex_t mutex_trylock(mutex_t *m){ + uint32_t status = 0; + mutex_t old_lock = __ldrex(m); // get mutex value + // set mutex + status = __strex(MUTEX_LOCKED, m); + if(status == 0) __dmb(); + else old_lock = MUTEX_LOCKED; + return old_lock; +} + +#endif diff --git a/simple_cdc/sync.h b/simple_cdc/sync.h new file mode 100644 index 0000000..bfe837b --- /dev/null +++ b/simple_cdc/sync.h @@ -0,0 +1,53 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Fergus Noble + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#ifndef LIBOPENCM3_CM3_SYNC_H +#define LIBOPENCM3_CM3_SYNC_H + +void __dmb(void); + +/* Implements synchronisation primitives as discussed in the ARM document + * DHT0008A (ID081709) "ARM Synchronization Primitives" and the ARM v7-M + * Architecture Reference Manual. +*/ + +/* --- Exclusive load and store instructions ------------------------------- */ + +/* Those are defined only on CM3 or CM4 */ +#if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) + +uint32_t __ldrex(volatile uint32_t *addr); +uint32_t __strex(uint32_t val, volatile uint32_t *addr); + +/* --- Convenience functions ----------------------------------------------- */ + +/* Here we implement some simple synchronisation primitives. */ + +typedef uint32_t mutex_t; + +#define MUTEX_UNLOCKED 0 +#define MUTEX_LOCKED 1 + +void mutex_lock(mutex_t *m); +void mutex_unlock(mutex_t *m); +mutex_t mutex_trylock(mutex_t *m); + +#endif + +#endif diff --git a/simple_cdc/usb_cdc_simple.bin b/simple_cdc/usb_cdc_simple.bin new file mode 100755 index 0000000..f4804c3 Binary files /dev/null and b/simple_cdc/usb_cdc_simple.bin differ diff --git a/simple_cdc/user_proto.c b/simple_cdc/user_proto.c new file mode 100644 index 0000000..7a6eb5e --- /dev/null +++ b/simple_cdc/user_proto.c @@ -0,0 +1,194 @@ +/* + * user_proto.c + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include "cdcacm.h" +#include "main.h" +#include "hardware_ini.h" + +// integer value given by user +static volatile int32_t User_value = 0; +enum{ + UVAL_START, // user start to write integer value + UVAL_ENTERED, // value entered but not printed + UVAL_BAD // entered bad value +}; +uint8_t Uval_ready = UVAL_BAD; + +int read_int(char *buf, int cnt); + +intfun I = NULL; // function to process entered integer + +#define READINT() do{i += read_int(&buf[i+1], len-i-1);}while(0) + +void help(){ + P("H\tshow this help\n"); + P("I\ttest entering integer value\n"); + P("T\tshow current approx. time\n"); +} + +/** + * show entered integer value + */ +uint8_t show_int(int32_t v){ + print_int(v); + newline(); + return 0; +} + +/** + * parce command buffer buf with length len + * return 0 if buffer processed or len if there's not enough data in buffer + */ +int parce_incoming_buf(char *buf, int len){ + uint8_t command; + //uint32_t utmp; + int i; + if(Uval_ready == UVAL_START){ // we are in process of user's value reading + i += read_int(buf, len); + } + if(Uval_ready == UVAL_ENTERED){ + print_int(User_value); // printout readed integer value for error control + Uval_ready = UVAL_BAD; // clear Uval + I(User_value); + return 0; + } + for(i = 0; i < len; i++){ + command = buf[i]; + if(!command) continue; // omit zero + switch (command){ + case 'H': // show help + help(); + break; + case 'I': // enter integer & show its value + I = show_int; + READINT(); + break; + case 'T': + print_int(Timer); // be careful for Time >= 2^{31}!!! + break; + case '\n': // show newline, space and tab as is + case '\r': + case ' ': + case '\t': + break; + default: + command = '?'; // echo '?' on unknown command in byte mode + } + usb_send(command); // echo readed byte + } + return 0; // all data processed - 0 bytes leave in buffer +} + +/** + * Send char array wrd thru USB or UART + */ +void prnt(uint8_t *wrd){ + if(!wrd) return; + while(*wrd) usb_send(*wrd++); +} + +/** + * Read from TTY integer value given by user (in DEC). + * Reading stops on first non-numeric symbol. + * To work with symbol terminals reading don't stops on buffer's end, + * it waits for first non-numeric char. + * When working on string terminals, terminate string by '\n', 0 or any other symbol + * @param buf - buffer to read from + * @param cnt - buffer length + * @return amount of readed symbols + */ +int read_int(char *buf, int cnt){ + int readed = 0, i; + static int enteredDigits; // amount of entered digits + static int sign; // sign of readed value + if(Uval_ready){ // this is first run + Uval_ready = UVAL_START; // clear flag + enteredDigits = 0; // 0 digits entered + User_value = 0; // clear value + sign = 1; // clear sign + } + if(!cnt) return 0; + for(i = 0; i < cnt; i++, readed++){ + uint8_t chr = buf[i]; + if(chr == '-'){ + if(enteredDigits == 0){ // sign should be first + sign = -1; + continue; + }else{ // '-' after number - reject entered value + Uval_ready = UVAL_BAD; + break; + } + } + if(chr < '0' || chr > '9'){ + if(enteredDigits) + Uval_ready = UVAL_ENTERED; + else + Uval_ready = UVAL_BAD; // bad symbol + break; + } + User_value = User_value * 10 + (int32_t)(chr - '0'); + enteredDigits++; + } + if(Uval_ready == UVAL_ENTERED) // reading has met an non-numeric character + User_value *= sign; + return readed; +} + +/** + * Print buff as hex values + * @param buf - buffer to print + * @param l - buf length + * @param s - function to send a byte + */ +void print_hex(uint8_t *buff, uint8_t l){ + void putc(uint8_t c){ + if(c < 10) + usb_send(c + '0'); + else + usb_send(c + 'a' - 10); + } + usb_send('0'); usb_send('x'); // prefix 0x + while(l--){ + putc(buff[l] >> 4); + putc(buff[l] & 0x0f); + } +} + +/** + * Print decimal integer value + * @param N - value to print + * @param s - function to send a byte + */ +void print_int(int32_t N){ + uint8_t buf[10], L = 0; + if(N < 0){ + usb_send('-'); + N = -N; + } + if(N){ + while(N){ + buf[L++] = N % 10 + '0'; + N /= 10; + } + while(L--) usb_send(buf[L]); + }else usb_send('0'); +} + diff --git a/simple_cdc/user_proto.h b/simple_cdc/user_proto.h new file mode 100644 index 0000000..4b0fc3a --- /dev/null +++ b/simple_cdc/user_proto.h @@ -0,0 +1,47 @@ +/* + * user_proto.h + * + * Copyright 2014 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#pragma once +#ifndef __USER_PROTO_H__ +#define __USER_PROTO_H__ + +#include "cdcacm.h" + +// shorthand for prnt +#define P(arg) do{prnt((uint8_t*)arg);}while(0) +// debug message - over USB +#ifdef EBUG + #define DBG(a) do{prnt((uint8_t*)a);}while(0) +#else + #define DBG(a) +#endif + +typedef uint8_t (*intfun)(int32_t); + +void prnt(uint8_t *wrd); +#define newline() usb_send('\n') + +void print_int(int32_t N); +void print_hex(uint8_t *buff, uint8_t l); + +int parce_incoming_buf(char *buf, int len); + +#endif // __USER_PROTO_H__