Skip to content

Commit d5f3cff

Browse files
committed
add board yehuo-f103-znz
1 parent df68980 commit d5f3cff

File tree

5 files changed

+45
-5
lines changed

5 files changed

+45
-5
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ generic-pe5: begin clean gccversion build_generic-pe5 sizeafter finished copy_g
130130
generic-pe5-button-pa0: begin clean gccversion build_generic-pe5-button-pa0 sizeafter finished copy_generic-pe5-button-pa0 end
131131
generic-pb7: begin clean gccversion build_generic-pb7 sizeafter finished copy_generic-pb7 end
132132
generic-pb0: begin clean gccversion build_generic-pb0 sizeafter finished copy_generic-pb0 end
133+
yehuo-znz: begin clean gccversion build_yehuo-znz sizeafter finished copy_yehuo-znz end
133134
stbee : begin clean gccversion build_stbee sizeafter finished copy_stbee end
134135
naze32: begin clean gccversion build_naze32 sizeafter finished copy_naze32 end
135136
generic-pb12: begin clean gccversion build_generic-pb12 sizeafter finished copy_generic-pb12 end
@@ -329,6 +330,17 @@ copy_generic-pb7:
329330
cp $(TARGET).bin bootloader_only_binaries/generic_boot20_pb7.bin
330331
@echo
331332

333+
build_yehuo-znz: TARGETFLAGS= -DTARGET_YEHUO_F103_ZNZ $(DEFINES)
334+
# Set the linker script
335+
build_yehuo-znz: LDFLAGS +=-T$(ST_LIB)/c_only_md_high_density.ld
336+
build_yehuo-znz: elf bin lss sym
337+
copy_yehuo-znz:
338+
@echo
339+
@echo "Copying to binaries folder"
340+
@echo
341+
cp $(TARGET).bin bootloader_only_binaries/yehuo_boot20_znz.bin
342+
@echo
343+
332344
build_generic-pb0: TARGETFLAGS= -DTARGET_GENERIC_F103_PB0 $(DEFINES)
333345
# Set the linker script
334346
build_generic-pb0: LDFLAGS +=-T$(ST_LIB)/c_only_md_high_density.ld
6.93 KB
Binary file not shown.

config.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define __CONFIG_H
3535

3636
#include "common.h"
37+
#include <stdint.h>
3738

3839

3940

@@ -159,7 +160,7 @@
159160
#define BUTTON_BANK GPIOB
160161
#define BUTTON_PIN 2
161162
#define BUTTON_PRESSED_STATE 1
162-
163+
163164
#elif defined TARGET_GENERIC_F103_PC13_FASTBOOT
164165

165166

@@ -289,6 +290,27 @@
289290
#define LED_ON_STATE 1
290291
#define BOOTLOADER_WAIT 30
291292

293+
#elif defined TARGET_YEHUO_F103_ZNZ
294+
295+
#define HAS_MAPLE_HARDWARE 1
296+
#define BOOTLOADER_WAIT 0
297+
298+
#define LED_BANK GPIOB
299+
#define LED_PIN 0
300+
#define LED_ON_STATE 0
301+
302+
#define FASTBOOT
303+
304+
/* BUTTON is PA0 (pull down) */
305+
#define BUTTON_BANK GPIOA
306+
#define BUTTON_PIN 0
307+
#define BUTTON_PRESSED_STATE 1
308+
309+
310+
/* USB Disc Pin Setup. USB DISC is PD6 */
311+
#define USB_DISC_BANK GPIOD
312+
#define USB_DISC_PIN 6
313+
292314
#elif defined TARGET_STBEE
293315

294316
#define HAS_MAPLE_HARDWARE 1
@@ -411,7 +433,7 @@
411433
#error "No config for this target"
412434
#endif
413435

414-
// Check if button pulldown should be enabled
436+
// Check if button pulldown should be enabled
415437
// Default to True as this was the default prior to needing to disable it
416438
// in order to use the boot1 pin on the Blue Pill which has a very week pullup
417439
#ifndef BUTTON_INPUT_MODE

usb.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@
3131
*/
3232

3333
#include "usb.h"
34+
3435
#include "dfu.h"
36+
#include "hardware.h"
37+
38+
u16 wTransferSize;
3539

3640

3741
extern u8 u8_usbConfigDescriptorDFU[];
3842
extern u8 u8_usbFunctionalDescriptor[];
3943

4044
void setupUSB (void) {
41-
4245
#ifdef HAS_MAPLE_HARDWARE
4346
/* Setup USB DISC pin as output open drain */
4447
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));
@@ -56,6 +59,7 @@ void setupUSB (void) {
5659

5760
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));
5861

62+
5963
gpio_write_bit(USB_DISC_BANK,USB_DISC_PIN,0); /* present ourselves to the host */
6064

6165
volatile unsigned int delay;

usb.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939
#define ENDP3_RXADDR 0x110
4040

4141
#define bMaxPacketSize 0x40 /* 64B, maximum for usb FS devices */
42-
//#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 */
42+
43+
//#define wTransferSize ((uint16_t)0x800)
44+
/* 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 */
4345
#define dummyTransferSize 0x800
44-
int wTransferSize;
46+
extern u16 wTransferSize;
4547

4648
#define NUM_ENDPTS 0x01
4749

0 commit comments

Comments
 (0)