summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorHierophect <hierophect@gmail.com>2019-07-01 19:47:10 -0400
committerHierophect <hierophect@gmail.com>2019-07-01 19:47:10 -0400
commit040acc3a3228c4204d8154656a1249171b68c75a (patch)
tree3779fce6327c7396d1d2e02ca1426bc64dffbc31 /ports
parent94a2eff05c410ee6a111efa0c48abd78b3518092 (diff)
remove dependencies for stable build
Diffstat (limited to 'ports')
-rwxr-xr-xports/stm32f4/Makefile28
-rw-r--r--ports/stm32f4/startup_stm32f411xe.s2
-rw-r--r--ports/stm32f4/supervisor/port.c2
-rw-r--r--ports/stm32f4/tick.c33
4 files changed, 31 insertions, 34 deletions
diff --git a/ports/stm32f4/Makefile b/ports/stm32f4/Makefile
index 142973f53..90e81291f 100755
--- a/ports/stm32f4/Makefile
+++ b/ports/stm32f4/Makefile
@@ -62,18 +62,13 @@ CROSS_COMPILE = arm-none-eabi-
INC += -I.
INC += -I../..
INC += -I$(BUILD)
-#keep?
INC += -I$(BUILD)/genhdr
-#HAL SPECIFIC
-INC += -IcubeMXInc
-INC += -IcubeMXDrivers/STM32F4xx_HAL_Driver/Inc
-INC += -IcubeMXDrivers/STM32F4xx_HAL_Driver/Inc/Legacy
-INC += -IcubeMXDrivers/CMSIS/Device/ST/STM32F4xx/Include
-INC += -IcubeMXDrivers/CMSIS/Include
-INC += -IcubeMXDrivers/CMSIS/Include
-#does order matter?
-INC += -Iboards/$(BOARD)
-#INC += -I./peripherals
+INC += -I./cubeMXInc
+INC += -I./cubeMXDrivers/STM32F4xx_HAL_Driver/Inc
+INC += -I./cubeMXDrivers/STM32F4xx_HAL_Driver/Inc/Legacy
+INC += -I./cubeMXDrivers/CMSIS/Device/ST/STM32F4xx/Include
+INC += -I./cubeMXDrivers/CMSIS/Include
+INC += -I./boards/$(BOARD)
INC += -I../../lib/mp-readline
INC += -I../../lib/tinyusb/src
INC += -I../../supervisor/shared/usb
@@ -118,7 +113,7 @@ CFLAGS += -D__START=main
#TODO: add LD file?
-LDFLAGS = $(CFLAGS) -nostartfiles -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
+LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
LIBS := -lgcc -lc
LDFLAGS += -mthumb -mcpu=cortex-m4
@@ -138,9 +133,10 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD
# source
######################################
+#cubeMXsrc/stm32f4xx_it.c \
+#cubeMXsrc/stm32f4xx_hal_msp.c \
+
SRC_STM32 = \
- cubeMXsrc/stm32f4xx_it.c \
- cubeMXsrc/stm32f4xx_hal_msp.c \
cubeMXDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
cubeMXDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
cubeMXDrivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
@@ -164,6 +160,7 @@ SRC_C += \
background.c \
fatfs_port.c \
mphalport.c \
+ tick.c \
boards/$(BOARD)/board.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \
@@ -176,7 +173,8 @@ SRC_C += \
lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
- supervisor/shared/memory.c
+ supervisor/shared/memory.c \
+ lib/tinyusb/src/portable/st/stm32f4/dcd_stm32f4.c
#
diff --git a/ports/stm32f4/startup_stm32f411xe.s b/ports/stm32f4/startup_stm32f411xe.s
index 6079df95e..3aac640cb 100644
--- a/ports/stm32f4/startup_stm32f411xe.s
+++ b/ports/stm32f4/startup_stm32f411xe.s
@@ -108,7 +108,7 @@ LoopFillZerobss:
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call static constructors */
- bl __libc_init_array
+/* bl __libc_init_array */
/* Call the application's entry point.*/
bl main
bx lr
diff --git a/ports/stm32f4/supervisor/port.c b/ports/stm32f4/supervisor/port.c
index df0019c06..93a297d0f 100644
--- a/ports/stm32f4/supervisor/port.c
+++ b/ports/stm32f4/supervisor/port.c
@@ -136,7 +136,7 @@ safe_mode_t port_init(void) {
// huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
// huart2.Init.OverSampling = UART_OVERSAMPLING_16;
- HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
+ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET);
return NO_SAFE_MODE;
}
diff --git a/ports/stm32f4/tick.c b/ports/stm32f4/tick.c
index 6d8fd13e0..41fdac6ff 100644
--- a/ports/stm32f4/tick.c
+++ b/ports/stm32f4/tick.c
@@ -30,7 +30,6 @@
#include "supervisor/filesystem.h"
#include "shared-module/gamepad/__init__.h"
#include "shared-bindings/microcontroller/Processor.h"
-#include "nrf.h"
// Global millisecond tick count
volatile uint64_t ticks_ms = 0;
@@ -54,31 +53,31 @@ void SysTick_Handler(void) {
}
void tick_init() {
- uint32_t ticks_per_ms = common_hal_mcu_processor_get_frequency() / 1000;
- SysTick_Config(ticks_per_ms); // interrupt is enabled
+ uint32_t ticks_per_ms = 16000000/ 1000;
+ //SysTick_Config(ticks_per_ms); // interrupt is enabled
}
void tick_delay(uint32_t us) {
- uint32_t ticks_per_us = common_hal_mcu_processor_get_frequency() / 1000 / 1000;
- uint32_t us_between_ticks = SysTick->VAL / ticks_per_us;
- uint64_t start_ms = ticks_ms;
- while (us > 1000) {
- while (ticks_ms == start_ms) {}
- us -= us_between_ticks;
- start_ms = ticks_ms;
- us_between_ticks = 1000;
- }
- while (SysTick->VAL > ((us_between_ticks - us) * ticks_per_us)) {}
+ // uint32_t ticks_per_us = 16000000 / 1000 / 1000;
+ // uint32_t us_between_ticks = SysTick->VAL / ticks_per_us;
+ // uint64_t start_ms = ticks_ms;
+ // while (us > 1000) {
+ // while (ticks_ms == start_ms) {}
+ // us -= us_between_ticks;
+ // start_ms = ticks_ms;
+ // us_between_ticks = 1000;
+ // }
+ //while (SysTick->VAL > ((us_between_ticks - us) * ticks_per_us)) {}
}
// us counts down!
void current_tick(uint64_t* ms, uint32_t* us_until_ms) {
- uint32_t ticks_per_us = common_hal_mcu_processor_get_frequency() / 1000 / 1000;
+ uint32_t ticks_per_us = 16000000 / 1000 / 1000;
*ms = ticks_ms;
- *us_until_ms = SysTick->VAL / ticks_per_us;
+ //*us_until_ms = SysTick->VAL / ticks_per_us;
}
void wait_until(uint64_t ms, uint32_t us_until_ms) {
- uint32_t ticks_per_us = common_hal_mcu_processor_get_frequency() / 1000 / 1000;
- while(ticks_ms <= ms && SysTick->VAL / ticks_per_us >= us_until_ms) {}
+ uint32_t ticks_per_us = 16000000 / 1000 / 1000;
+ //while(ticks_ms <= ms && SysTick->VAL / ticks_per_us >= us_until_ms) {}
}