Skip to content

Commit

Permalink
fixing ci build
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jan 20, 2025
1 parent 332868d commit 2782c29
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 33 deletions.
49 changes: 17 additions & 32 deletions ports/mimxrt10xx/apps/esp32programmer/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,34 @@ static uint32_t baud_rate = 115200;
// Timer
//--------------------------------------------------------------------+

TU_ATTR_ALWAYS_INLINE static inline uint32_t millis(void)
{
TU_ATTR_ALWAYS_INLINE static inline uint32_t millis(void) {
return _timer_count;
}

static inline void delay_blocking(uint32_t ms)
{
static inline void delay_blocking(uint32_t ms) {
uint32_t start = _timer_count;
while(_timer_count - start < ms)
{
while (_timer_count - start < ms) {
tud_task();
}
}

void board_timer_handler(void)
{
void board_timer_handler(void) {
_timer_count++;
}

//--------------------------------------------------------------------+
// ESP32 Helper
//--------------------------------------------------------------------+

static inline void esp32_set_io0(uint8_t state)
{
static inline void esp32_set_io0(uint8_t state) {
GPIO_PinWrite(ESP32_GPIO0_PORT, ESP32_GPIO0_PIN, state);
}

static inline void esp32_set_en(uint8_t state)
{
static inline void esp32_set_en(uint8_t state) {
GPIO_PinWrite(ESP32_RESET_PORT, ESP32_RESET_PIN, state);
}

void esp32_manual_enter_dfu(void)
{
void esp32_manual_enter_dfu(void) {
// Put ESP into upload mode
esp32_set_io0(1);
esp32_set_en(0);
Expand All @@ -109,8 +102,7 @@ void esp32_manual_enter_dfu(void)
//--------------------------------------------------------------------+
// Main
//--------------------------------------------------------------------+
int main(void)
{
int main(void) {
board_init();

gpio_pin_config_t pin_config = { kGPIO_DigitalOutput, 1, kGPIO_NoIntmode };
Expand All @@ -127,23 +119,21 @@ int main(void)

board_uart_init(115200);
board_usb_init();
tusb_init();
tud_init(BOARD_TUD_RHPORT);

board_timer_start(1);

#if !ESP32_DTR_RTS_BOOT_RESET_SUPPORT
esp32_manual_enter_dfu();
#endif

while(1)
{
while (1) {
uint8_t serial_buf[512];
uint32_t count;

// UART -> USB
count = (uint32_t) board_uart_read(serial_buf, sizeof(serial_buf));
if (count)
{
count = (uint32_t)board_uart_read(serial_buf, sizeof(serial_buf));
if (count) {
board_led_write(0xff);

tud_cdc_write(serial_buf, count);
Expand All @@ -153,8 +143,7 @@ int main(void)
}

// USB -> UART
while ( tud_cdc_available() )
{
while (tud_cdc_available()) {
board_led_write(0xff);

count = tud_cdc_read(serial_buf, sizeof(serial_buf));
Expand Down Expand Up @@ -184,22 +173,18 @@ int main(void)
//}

// Invoked when line coding is change via SET_LINE_CODING
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
{
(void) itf;
void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding) {
(void)itf;

if ( baud_rate != line_coding->bit_rate )
{
if (baud_rate != line_coding->bit_rate) {
baud_rate = line_coding->bit_rate;

// must be the same freq as board_init()
uint32_t freq;
if (CLOCK_GetMux(kCLOCK_UartMux) == 0) /* PLL3 div6 80M */
{
freq = (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
}
else
{
} else {
freq = CLOCK_GetOscFreq() / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U);
}

Expand Down
2 changes: 1 addition & 1 deletion ports/mimxrt10xx/apps/factory_test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(void) {
board_timer_start(1);

board_usb_init();
tusb_init();
tud_init(BOARD_TUD_RHPORT);

setColor(0);
pinMode(13, OUTPUT);
Expand Down
1 change: 1 addition & 0 deletions ports/stm32f4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_executable(tinyuf2
board_flash.c
boards.c
${TOP}/lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
${TOP}/lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
)
target_link_options(tinyuf2 PUBLIC
"LINKER:--script=${CMAKE_CURRENT_LIST_DIR}/linker/stm32f4_boot.ld"
Expand Down
1 change: 1 addition & 0 deletions ports/stm32f4/port.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ SRC_C += \

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
endif

# Port include
Expand Down
1 change: 1 addition & 0 deletions ports/stm32h5/port.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ SRC_C += \

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
endif

# Port include
Expand Down
1 change: 1 addition & 0 deletions ports/stm32h7/port.mk
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SRC_C += \

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
endif

# Includes
Expand Down
1 change: 1 addition & 0 deletions ports/stm32l4/port.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SRC_C += \

ifndef BUILD_NO_TINYUSB
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
SRC_C += lib/tinyusb/src/portable/synopsys/dwc2/dwc2_common.c
endif

# Port include
Expand Down

0 comments on commit 2782c29

Please sign in to comment.