remove dependencies for stable build

This commit is contained in:
Hierophect 2019-07-01 19:47:10 -04:00
parent 94a2eff05c
commit 040acc3a32
7 changed files with 34 additions and 36 deletions

View File

@ -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
#

View File

@ -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

View File

@ -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;
}

View File

@ -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) {}
}

View File

@ -47,6 +47,7 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t*
// Wait until interface is ready, timeout = 2 seconds
uint64_t end_ticks = ticks_ms + 2000;
while ( (ticks_ms < end_ticks) && !tud_hid_generic_ready() ) { }
if ( !tud_hid_generic_ready() ) {

View File

@ -118,5 +118,5 @@ supervisor_allocation* allocate_memory(uint32_t length, bool high) {
}
void supervisor_move_memory(void) {
supervisor_display_move_memory();
//supervisor_display_move_memory();
}

View File

@ -41,7 +41,7 @@ extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2];
void load_serial_number(void) {
// create serial number based on device unique id
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
common_hal_mcu_processor_get_uid(raw_id);
//common_hal_mcu_processor_get_uid(raw_id);
static const char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'};