Skip to content

Instantly share code, notes, and snippets.

@nathantsoi
Last active April 15, 2018 01:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathantsoi/b24232791d3ec9390a51fab141c7a4bb to your computer and use it in GitHub Desktop.
Save nathantsoi/b24232791d3ec9390a51fab141c7a4bb to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index e08e935..f41e061 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,7 @@ TARGETS = \
auavx2v1_bl \
crazyflie_bl \
mindpxv2_bl \
+ omnibusnxt_bl \
px4aerocore_bl \
px4discovery_bl \
px4flow_bl \
@@ -99,6 +100,9 @@ px4aerocore_bl: $(MAKEFILE_LIST) $(LIBOPENCM3)
crazyflie_bl: $(MAKEFILE_LIST) $(LIBOPENCM3)
${MAKE} ${MKFLAGS} -f Makefile.f4 TARGET_HW=CRAZYFLIE LINKER_FILE=stm32f4.ld TARGET_FILE_NAME=$@
+omnibusnxt_bl: $(MAKEFILE_LIST) $(LIBOPENCM3)
+ ${MAKE} ${MKFLAGS} -f Makefile.f4 TARGET_HW=OMNIBUS_NXT LINKER_FILE=stm32f4.ld TARGET_FILE_NAME=$@
+
cube_f4_bl: $(MAKEFILE_LIST) $(LIBOPENCM3)
${MAKE} ${MKFLAGS} -f Makefile.f4 TARGET_HW=CUBE_F4 LINKER_FILE=stm32f4.ld TARGET_FILE_NAME=$@
diff --git a/hw_config.h b/hw_config.h
index 7535190..2d82c63 100644
--- a/hw_config.h
+++ b/hw_config.h
@@ -636,6 +636,40 @@
# define USBMFGSTRING "Bitcraze AB"
+/****************************************************************************
+ * TARGET_HW_OMNIBUS_NXT
+ ****************************************************************************/
+
+#elif defined(TARGET_HW_OMNIBUS_NXT)
+
+# define APP_LOAD_ADDRESS 0x08004000
+# define BOOTLOADER_DELAY 5000
+# define BOARD_OMNIBUSNXT
+# define INTERFACE_USB 1
+# define INTERFACE_USART 0
+# define USBDEVICESTRING "Omnibus NXT"
+# define USBPRODUCTID 0x0016
+
+# define BOARD_TYPE 12
+# define BOARD_FLASH_SECTORS 11
+# define BOARD_FLASH_SIZE (1024 * 1024)
+
+# define OSC_FREQ 8
+
+# define BOARD_PIN_LED_ACTIVITY GPIO5
+# define BOARD_PIN_LED_BOOTLOADER GPIO13
+# define BOARD_PORT_LEDS GPIOB
+# define BOARD_CLOCK_LEDS RCC_AHB1ENR_IOPBEN
+# define BOARD_LED_ON gpio_clear
+# define BOARD_LED_OFF gpio_set
+
+# define BOARD_USB_VBUS_SENSE_DISABLED
+//# define BOARD_PIN_VBUS GPIO5
+//# define BOARD_PORT_VBUS GPIOC
+//# define BOARD_CLOCK_VBUS RCC_AHB1ENR_IOPCEN
+
+# define USBMFGSTRING "Vertile"
+
/****************************************************************************
* TARGET_HW_AUAV_X2V1
****************************************************************************/
diff --git a/main_f4.c b/main_f4.c
index 23ed84d..905aa11 100644
--- a/main_f4.c
+++ b/main_f4.c
@@ -81,6 +81,13 @@ static struct {
#define REVID_MASK 0xFFFF0000
#define DEVID_MASK 0xFFF
+#ifndef BOARD_PIN_VBUS
+# define BOARD_PIN_VBUS GPIO9
+# define BOARD_PORT_VBUS GPIOA
+# define BOARD_CLOCK_VBUS RCC_AHB1ENR_IOPAEN
+#endif
+
+
/* magic numbers from reference manual */
typedef enum mcu_rev_e {
@@ -349,8 +356,7 @@ board_init(void)
#if INTERFACE_USB
- /* enable Port A GPIO9 to sample VBUS */
- rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
+ rcc_peripheral_enable_clock(&RCC_AHB1ENR, BOARD_CLOCK_VBUS);
#endif
#if INTERFACE_USART
@@ -781,7 +787,7 @@ main(void)
#if defined(BOARD_USB_VBUS_SENSE_DISABLED)
try_boot = false;
#else
- if (gpio_get(GPIOA, GPIO9) != 0) {
+ if (gpio_get(BOARD_PORT_VBUS, BOARD_PIN_VBUS) != 0) {
/* don't try booting before we set up the bootloader */
try_boot = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment