Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ generic-pe5: begin clean gccversion build_generic-pe5 sizeafter finished copy_g
generic-pe5-button-pa0: begin clean gccversion build_generic-pe5-button-pa0 sizeafter finished copy_generic-pe5-button-pa0 end
generic-pb7: begin clean gccversion build_generic-pb7 sizeafter finished copy_generic-pb7 end
generic-pb0: begin clean gccversion build_generic-pb0 sizeafter finished copy_generic-pb0 end
yehuo-znz: begin clean gccversion build_yehuo-znz sizeafter finished copy_yehuo-znz end
stbee : begin clean gccversion build_stbee sizeafter finished copy_stbee end
naze32: begin clean gccversion build_naze32 sizeafter finished copy_naze32 end
generic-pb12: begin clean gccversion build_generic-pb12 sizeafter finished copy_generic-pb12 end
Expand Down Expand Up @@ -329,6 +330,17 @@ copy_generic-pb7:
cp $(TARGET).bin bootloader_only_binaries/generic_boot20_pb7.bin
@echo

build_yehuo-znz: TARGETFLAGS= -DTARGET_YEHUO_F103_ZNZ $(DEFINES)
# Set the linker script
build_yehuo-znz: LDFLAGS +=-T$(ST_LIB)/c_only_md_high_density.ld
build_yehuo-znz: elf bin lss sym
copy_yehuo-znz:
@echo
@echo "Copying to binaries folder"
@echo
cp $(TARGET).bin bootloader_only_binaries/yehuo_boot20_znz.bin
@echo

build_generic-pb0: TARGETFLAGS= -DTARGET_GENERIC_F103_PB0 $(DEFINES)
# Set the linker script
build_generic-pb0: LDFLAGS +=-T$(ST_LIB)/c_only_md_high_density.ld
Expand Down
Binary file added bootloader_only_binaries/yehuo_boot20_znz.bin
Binary file not shown.
26 changes: 24 additions & 2 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define __CONFIG_H

#include "common.h"
#include <stdint.h>



Expand Down Expand Up @@ -159,7 +160,7 @@
#define BUTTON_BANK GPIOB
#define BUTTON_PIN 2
#define BUTTON_PRESSED_STATE 1

#elif defined TARGET_GENERIC_F103_PC13_FASTBOOT


Expand Down Expand Up @@ -289,6 +290,27 @@
#define LED_ON_STATE 1
#define BOOTLOADER_WAIT 30

#elif defined TARGET_YEHUO_F103_ZNZ

#define HAS_MAPLE_HARDWARE 1
#define BOOTLOADER_WAIT 0

#define LED_BANK GPIOB
#define LED_PIN 0
#define LED_ON_STATE 0

#define FASTBOOT

/* BUTTON is PA0 (pull down) */
#define BUTTON_BANK GPIOA
#define BUTTON_PIN 0
#define BUTTON_PRESSED_STATE 1


/* USB Disc Pin Setup. USB DISC is PD6 */
#define USB_DISC_BANK GPIOD
#define USB_DISC_PIN 6

#elif defined TARGET_STBEE

#define HAS_MAPLE_HARDWARE 1
Expand Down Expand Up @@ -411,7 +433,7 @@
#error "No config for this target"
#endif

// Check if button pulldown should be enabled
// Check if button pulldown should be enabled
// Default to True as this was the default prior to needing to disable it
// in order to use the boot1 pin on the Blue Pill which has a very week pullup
#ifndef BUTTON_INPUT_MODE
Expand Down
6 changes: 5 additions & 1 deletion usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@
*/

#include "usb.h"

#include "dfu.h"
#include "hardware.h"

u16 wTransferSize;


extern u8 u8_usbConfigDescriptorDFU[];
extern u8 u8_usbFunctionalDescriptor[];

void setupUSB (void) {

#ifdef HAS_MAPLE_HARDWARE
/* Setup USB DISC pin as output open drain */
SET_REG(GPIO_CR(USB_DISC_BANK,USB_DISC_PIN),(GET_REG(GPIO_CR(USB_DISC_BANK,USB_DISC_PIN)) & crMask(USB_DISC_PIN)) | CR_OUTPUT_OD << CR_SHITF(USB_DISC_PIN));
Expand All @@ -56,6 +59,7 @@ void setupUSB (void) {

SET_REG(GPIO_CR(USB_DISC_BANK,USB_DISC_PIN),(GET_REG(GPIO_CR(USB_DISC_BANK,USB_DISC_PIN)) & crMask(USB_DISC_PIN)) | CR_OUTPUT_PP << CR_SHITF(USB_DISC_PIN));


gpio_write_bit(USB_DISC_BANK,USB_DISC_PIN,0); /* present ourselves to the host */

volatile unsigned int delay;
Expand Down
6 changes: 4 additions & 2 deletions usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
#define ENDP3_RXADDR 0x110

#define bMaxPacketSize 0x40 /* 64B, maximum for usb FS devices */
//#define wTransferSize FLASH_PAGE_SIZE /* This is important, because transfers have to match with the flash page size, otherwise it erases a page before its finished copying to that page */

//#define wTransferSize ((uint16_t)0x800)
/* This is important, because transfers have to match with the flash page size, otherwise it erases a page before its finished copying to that page */
#define dummyTransferSize 0x800
int wTransferSize;
extern u16 wTransferSize;

#define NUM_ENDPTS 0x01

Expand Down