Merge branch 'master' into master
This commit is contained in:
+4
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Low Level MCU header include. TinyUSB stack and example should be
|
||||
// platform independent and mostly doens't need to include this file.
|
||||
// platform independent and mostly doesn't need to include this file.
|
||||
// However there are still certain situation where this file is needed:
|
||||
// - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
|
||||
// - SWO logging for Cortex M with ITM_SendChar() / ITM_ReceiveChar()
|
||||
@@ -146,6 +146,9 @@
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_TM4C123
|
||||
#include "TM4C123.h"
|
||||
|
||||
#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837)
|
||||
// no header needed
|
||||
|
||||
#else
|
||||
#error "Missing MCU header"
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
CFLAGS += -mcpu=arm1176jzf-s \
|
||||
-DBCM_VERSION=2835 \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_BCM2835
|
||||
|
||||
SUFFIX =
|
||||
@@ -27,8 +27,9 @@
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
#include "broadcom/cpu.h"
|
||||
#include "broadcom/gpio.h"
|
||||
#include "broadcom/interrupts.h"
|
||||
#include "broadcom/io.h"
|
||||
#include "broadcom/mmu.h"
|
||||
#include "broadcom/caches.h"
|
||||
#include "broadcom/vcmailbox.h"
|
||||
@@ -37,9 +38,8 @@
|
||||
#define LED_PIN 18
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
// Button
|
||||
#define BUTTON_PIN 16
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
// UART TX
|
||||
#define UART_TX_PIN 14
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
@@ -62,14 +62,26 @@ void board_init(void)
|
||||
init_caches();
|
||||
|
||||
// LED
|
||||
gpio_initOutputPinWithPullNone(LED_PIN);
|
||||
gpio_set_function(LED_PIN, GPIO_FUNCTION_OUTPUT);
|
||||
gpio_set_pull(LED_PIN, BP_PULL_NONE);
|
||||
board_led_write(true);
|
||||
|
||||
// Button
|
||||
// TODO
|
||||
|
||||
// Uart
|
||||
uart_init();
|
||||
COMPLETE_MEMORY_READS;
|
||||
AUX->ENABLES_b.UART_1 = true;
|
||||
|
||||
UART1->IER = 0;
|
||||
UART1->CNTL = 0;
|
||||
UART1->LCR_b.DATA_SIZE = UART1_LCR_DATA_SIZE_MODE_8BIT;
|
||||
UART1->MCR = 0;
|
||||
UART1->IER = 0;
|
||||
|
||||
uint32_t source_clock = vcmailbox_get_clock_rate_measured(VCMAILBOX_CLOCK_CORE);
|
||||
UART1->BAUD = ((source_clock / (115200 * 8)) - 1);
|
||||
UART1->CNTL |= UART1_CNTL_TX_ENABLE_Msk;
|
||||
COMPLETE_MEMORY_READS;
|
||||
|
||||
gpio_set_function(UART_TX_PIN, GPIO_FUNCTION_ALT5);
|
||||
|
||||
// Turn on USB peripheral.
|
||||
vcmailbox_set_power_state(VCMAILBOX_DEVICE_USB_HCD, true);
|
||||
@@ -87,7 +99,7 @@ void board_init(void)
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
gpio_setPinOutputBool(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
gpio_set_value(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
@@ -0,0 +1,46 @@
|
||||
MCU_DIR = hw/mcu/broadcom
|
||||
DEPS_SUBMODULES += $(MCU_DIR)
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
-Wall \
|
||||
-O0 \
|
||||
-ffreestanding \
|
||||
-nostdlib \
|
||||
-nostartfiles \
|
||||
-mgeneral-regs-only \
|
||||
-fno-exceptions \
|
||||
-std=c17
|
||||
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
|
||||
# mcu driver cause following warnings
|
||||
CFLAGS += -Wno-error=cast-qual
|
||||
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
$(MCU_DIR)/broadcom/gen/interrupt_handlers.c \
|
||||
$(MCU_DIR)/broadcom/gpio.c \
|
||||
$(MCU_DIR)/broadcom/interrupts.c \
|
||||
$(MCU_DIR)/broadcom/mmu.c \
|
||||
$(MCU_DIR)/broadcom/caches.c \
|
||||
$(MCU_DIR)/broadcom/vcmailbox.c
|
||||
|
||||
SKIP_NANOLIB = 1
|
||||
|
||||
LD_FILE = $(MCU_DIR)/broadcom/link$(SUFFIX).ld
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/$(MCU_DIR)
|
||||
|
||||
SRC_S += $(MCU_DIR)/broadcom/boot$(SUFFIX).S
|
||||
|
||||
$(BUILD)/kernel$(SUFFIX).img: $(BUILD)/$(PROJECT).elf
|
||||
$(OBJCOPY) -O binary $^ $@
|
||||
|
||||
# Copy to kernel to netboot drive or SD card
|
||||
# Change destinaation to fit your need
|
||||
flash: $(BUILD)/kernel$(SUFFIX).img
|
||||
@$(CP) $< /home/$(USER)/Documents/code/pi_tinyusb/boot_cpy
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,3 @@
|
||||
CFLAGS += -mcpu=cortex-a72 \
|
||||
-DBCM_VERSION=2711 \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_BCM2711
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
@@ -0,0 +1,3 @@
|
||||
CFLAGS += -mcpu=cortex-a53 \
|
||||
-DBCM_VERSION=2837 \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_BCM2837
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
#include "broadcom/cpu.h"
|
||||
#include "broadcom/gpio.h"
|
||||
#include "broadcom/interrupts.h"
|
||||
#include "broadcom/mmu.h"
|
||||
#include "broadcom/caches.h"
|
||||
#include "broadcom/vcmailbox.h"
|
||||
|
||||
// LED
|
||||
#define LED_PIN 18
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
// UART TX
|
||||
#define UART_TX_PIN 14
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
void USB_IRQHandler(void)
|
||||
{
|
||||
tud_int_handler(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
void board_init(void)
|
||||
{
|
||||
setup_mmu_flat_map();
|
||||
init_caches();
|
||||
|
||||
// LED
|
||||
gpio_set_function(LED_PIN, GPIO_FUNCTION_OUTPUT);
|
||||
gpio_set_pull(LED_PIN, BP_PULL_NONE);
|
||||
board_led_write(true);
|
||||
|
||||
// Uart
|
||||
COMPLETE_MEMORY_READS;
|
||||
AUX->ENABLES_b.UART_1 = true;
|
||||
|
||||
UART1->IER = 0;
|
||||
UART1->CNTL = 0;
|
||||
UART1->LCR_b.DATA_SIZE = UART1_LCR_DATA_SIZE_MODE_8BIT;
|
||||
UART1->MCR = 0;
|
||||
UART1->IER = 0;
|
||||
|
||||
uint32_t source_clock = vcmailbox_get_clock_rate_measured(VCMAILBOX_CLOCK_CORE);
|
||||
UART1->BAUD = ((source_clock / (115200 * 8)) - 1);
|
||||
UART1->CNTL |= UART1_CNTL_TX_ENABLE_Msk;
|
||||
COMPLETE_MEMORY_READS;
|
||||
|
||||
gpio_set_function(UART_TX_PIN, GPIO_FUNCTION_ALT5);
|
||||
|
||||
// Turn on USB peripheral.
|
||||
vcmailbox_set_power_state(VCMAILBOX_DEVICE_USB_HCD, true);
|
||||
|
||||
// Timer 1/1024 second tick
|
||||
SYSTMR->CS_b.M1 = 1;
|
||||
SYSTMR->C1 = SYSTMR->CLO + 977;
|
||||
BP_EnableIRQ(TIMER_1_IRQn);
|
||||
|
||||
BP_SetPriority(USB_IRQn, 0x00);
|
||||
BP_ClearPendingIRQ(USB_IRQn);
|
||||
BP_EnableIRQ(USB_IRQn);
|
||||
BP_EnableIRQs();
|
||||
}
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
gpio_set_value(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_uart_read(uint8_t* buf, int len)
|
||||
{
|
||||
(void) buf; (void) len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
const char* cbuf = buf;
|
||||
while (!UART1->STAT_b.TX_READY) {}
|
||||
if (cbuf[i] == '\n') {
|
||||
UART1->IO = '\r';
|
||||
while (!UART1->STAT_b.TX_READY) {}
|
||||
}
|
||||
UART1->IO = cbuf[i];
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
volatile uint32_t system_ticks = 0;
|
||||
|
||||
void TIMER_1_IRQHandler(void)
|
||||
{
|
||||
system_ticks++;
|
||||
SYSTMR->C1 += 977;
|
||||
SYSTMR->CS_b.M1 = 1;
|
||||
}
|
||||
|
||||
uint32_t board_millis(void)
|
||||
{
|
||||
return system_ticks;
|
||||
}
|
||||
#endif
|
||||
|
||||
void HardFault_Handler (void)
|
||||
{
|
||||
// asm("bkpt");
|
||||
}
|
||||
|
||||
// Required by __libc_init_array in startup code if we are compiling using
|
||||
// -nostdlib/-nostartfiles.
|
||||
void _init(void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -3,18 +3,16 @@ DEPS_SUBMODULES += $(MCU_DIR)
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CC = clang
|
||||
|
||||
CFLAGS += \
|
||||
-mcpu=cortex-a72 \
|
||||
-Wall \
|
||||
-O0 \
|
||||
-ffreestanding \
|
||||
-nostdlib \
|
||||
-nostartfiles \
|
||||
-std=c17 \
|
||||
-mgeneral-regs-only \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_BCM2711
|
||||
-std=c17
|
||||
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
|
||||
# mcu driver cause following warnings
|
||||
CFLAGS += -Wno-error=cast-qual
|
||||
@@ -22,25 +20,22 @@ CFLAGS += -Wno-error=cast-qual
|
||||
SRC_C += \
|
||||
src/portable/synopsys/dwc2/dcd_dwc2.c \
|
||||
$(MCU_DIR)/broadcom/gen/interrupt_handlers.c \
|
||||
$(MCU_DIR)/broadcom/gpio.c \
|
||||
$(MCU_DIR)/broadcom/interrupts.c \
|
||||
$(MCU_DIR)/broadcom/io.c \
|
||||
$(MCU_DIR)/broadcom/mmu.c \
|
||||
$(MCU_DIR)/broadcom/caches.c \
|
||||
$(MCU_DIR)/broadcom/vcmailbox.c
|
||||
|
||||
|
||||
CROSS_COMPILE = aarch64-none-elf-
|
||||
|
||||
SKIP_NANOLIB = 1
|
||||
|
||||
LD_FILE = $(MCU_DIR)/broadcom/link.ld
|
||||
LD_FILE = $(MCU_DIR)/broadcom/link8.ld
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/$(MCU_DIR) \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core_A/Include
|
||||
|
||||
SRC_S += $(MCU_DIR)/broadcom/boot.S
|
||||
SRC_S += $(MCU_DIR)/broadcom/boot8.S
|
||||
|
||||
$(BUILD)/kernel8.img: $(BUILD)/$(PROJECT).elf
|
||||
$(OBJCOPY) -O binary $^ $@
|
||||
@@ -48,4 +43,4 @@ $(BUILD)/kernel8.img: $(BUILD)/$(PROJECT).elf
|
||||
# Copy to kernel to netboot drive or SD card
|
||||
# Change destinaation to fit your need
|
||||
flash: $(BUILD)/kernel8.img
|
||||
$(CP) $< /home/$(USER)/Documents/code/pi4_tinyusb/boot_cpy
|
||||
@$(CP) $< /home/$(USER)/Documents/code/pi_tinyusb/boot_cpy
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright 2021 Bridgetek Pte Ltd
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
// Note: This definition file covers all MM900EV1B, MM900EV2B, and MM900EV3B boards.
|
||||
// Each of these boards has an FT900 device.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GPIO_UART0_TX 48
|
||||
#define GPIO_UART0_RX 49
|
||||
#define GPIO_ETH_LED0 61
|
||||
#define GPIO_ETH_LED1 62
|
||||
#define GPIO_REMOTE_WAKEUP_PIN 18
|
||||
#define USBD_VBUS_DTC_PIN 3
|
||||
|
||||
#define GPIO_REMOTE_WAKEUP
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright 2021 Bridgetek Pte Ltd
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "board.h"
|
||||
|
||||
#include <registers/ft900_registers.h>
|
||||
#include <ft900.h>
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED
|
||||
int8_t board_ft90x_vbus(void); // Board specific implementation of VBUS detection for USB device.
|
||||
extern void ft90x_usbd_pm_ISR(uint16_t pmcfg); // Interrupt handler for USB device power management
|
||||
#endif
|
||||
|
||||
#ifdef GPIO_REMOTE_WAKEUP
|
||||
void gpio_ISR(void);
|
||||
#endif
|
||||
void timer_ISR(void);
|
||||
volatile unsigned int timer_ms = 0;
|
||||
void board_pm_ISR(void);
|
||||
|
||||
#define WELCOME_MSG "\x1B[2J\x1B[H" \
|
||||
"MM900EVxB board\r\n"
|
||||
|
||||
// Initialize on-board peripherals : led, button, uart and USB
|
||||
void board_init(void)
|
||||
{
|
||||
sys_reset_all();
|
||||
// Enable the UART Device.
|
||||
sys_enable(sys_device_uart0);
|
||||
// Set UART0 GPIO functions to UART0_TXD and UART0_RXD.
|
||||
gpio_function(GPIO_UART0_TX, pad_uart0_txd); /* UART0 TXD */
|
||||
gpio_function(GPIO_UART0_RX, pad_uart0_rxd); /* UART0 RXD */
|
||||
uart_open(UART0, /* Device */
|
||||
1, /* Prescaler = 1 */
|
||||
UART_DIVIDER_19200_BAUD, /* Divider = 1302 */
|
||||
uart_data_bits_8, /* No. Data Bits */
|
||||
uart_parity_none, /* Parity */
|
||||
uart_stop_bits_1); /* No. Stop Bits */
|
||||
// Print out a welcome message.
|
||||
// Use sizeof to avoid pulling in strlen unnecessarily.
|
||||
board_uart_write(WELCOME_MSG, sizeof(WELCOME_MSG));
|
||||
|
||||
#if 0
|
||||
// Ethernet LEDs
|
||||
gpio_function(GPIO_ETH_LED0, pad_gpio4); /* ETH LED0 */
|
||||
gpio_dir(GPIO_ETH_LED0, pad_dir_open_drain);
|
||||
gpio_function(GPIO_ETH_LED1, pad_gpio5); /* ETH LED1 */
|
||||
gpio_dir(GPIO_ETH_LED1, pad_dir_output);
|
||||
#endif
|
||||
|
||||
sys_enable(sys_device_timer_wdt);
|
||||
/* Timer A = 1ms */
|
||||
timer_prescaler(timer_select_a, 1000);
|
||||
timer_init(timer_select_a, 100, timer_direction_down, timer_prescaler_select_on, timer_mode_continuous);
|
||||
timer_enable_interrupt(timer_select_a);
|
||||
timer_start(timer_select_a);
|
||||
interrupt_attach(interrupt_timers, (int8_t)interrupt_timers, timer_ISR);
|
||||
|
||||
// Setup VBUS detect GPIO. If the device is connected then this
|
||||
// will set the MASK_SYS_PMCFG_DEV_DETECT_EN bit in PMCFG.
|
||||
gpio_interrupt_disable(USBD_VBUS_DTC_PIN);
|
||||
gpio_function(USBD_VBUS_DTC_PIN, pad_vbus_dtc);
|
||||
gpio_pull(USBD_VBUS_DTC_PIN, pad_pull_pulldown);
|
||||
gpio_dir(USBD_VBUS_DTC_PIN, pad_dir_input);
|
||||
|
||||
interrupt_attach(interrupt_0, (int8_t)interrupt_0, board_pm_ISR);
|
||||
|
||||
#ifdef GPIO_REMOTE_WAKEUP
|
||||
//Configuring GPIO pin to wakeup.
|
||||
// Set up the wakeup pin.
|
||||
gpio_dir(GPIO_REMOTE_WAKEUP_PIN, pad_dir_input);
|
||||
gpio_pull(GPIO_REMOTE_WAKEUP_PIN, pad_pull_pullup);
|
||||
|
||||
// Attach an interrupt handler.
|
||||
interrupt_attach(interrupt_gpio, (uint8_t)interrupt_gpio, gpio_ISR);
|
||||
gpio_interrupt_enable(GPIO_REMOTE_WAKEUP_PIN, gpio_int_edge_falling);
|
||||
#endif
|
||||
|
||||
uart_disable_interrupt(UART0, uart_interrupt_tx);
|
||||
uart_disable_interrupt(UART0, uart_interrupt_rx);
|
||||
|
||||
// Enable all peripheral interrupts.
|
||||
interrupt_enable_globally();
|
||||
|
||||
TU_LOG1("MM900EV1B board setup complete\r\n");
|
||||
};
|
||||
|
||||
void timer_ISR(void)
|
||||
{
|
||||
if (timer_is_interrupted(timer_select_a))
|
||||
{
|
||||
timer_ms++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GPIO_REMOTE_WAKEUP
|
||||
void gpio_ISR(void)
|
||||
{
|
||||
if (gpio_is_interrupted(GPIO_REMOTE_WAKEUP_PIN))
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Power management ISR */
|
||||
void board_pm_ISR(void)
|
||||
{
|
||||
uint16_t pmcfg = SYS->PMCFG_H;
|
||||
|
||||
#if defined(__FT930__)
|
||||
if (pmcfg & MASK_SYS_PMCFG_SLAVE_PERI_IRQ_PEND)
|
||||
{
|
||||
// Clear d2xx hw engine wakeup.
|
||||
SYS->PMCFG_H = MASK_SYS_PMCFG_SLAVE_PERI_IRQ_PEND;
|
||||
}
|
||||
#endif
|
||||
if (pmcfg & MASK_SYS_PMCFG_PM_GPIO_IRQ_PEND)
|
||||
{
|
||||
// Clear GPIO wakeup pending.
|
||||
SYS->PMCFG_H = MASK_SYS_PMCFG_PM_GPIO_IRQ_PEND;
|
||||
}
|
||||
|
||||
#if defined(__FT900__)
|
||||
// USB device power management interrupts.
|
||||
if (pmcfg & (MASK_SYS_PMCFG_DEV_CONN_DEV |
|
||||
MASK_SYS_PMCFG_DEV_DIS_DEV |
|
||||
MASK_SYS_PMCFG_HOST_RST_DEV |
|
||||
MASK_SYS_PMCFG_HOST_RESUME_DEV)
|
||||
)
|
||||
{
|
||||
#if TUSB_OPT_DEVICE_ENABLED
|
||||
ft90x_usbd_pm_ISR(pmcfg);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED
|
||||
int8_t board_ft90x_vbus(void)
|
||||
{
|
||||
return gpio_read(USBD_VBUS_DTC_PIN);
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Turn LED on or off
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
gpio_write(GPIO_ETH_LED0, state);
|
||||
}
|
||||
|
||||
// Get the current state of button
|
||||
// a '1' means active (pressed), a '0' means inactive.
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get characters from UART
|
||||
int board_uart_read(uint8_t *buf, int len)
|
||||
{
|
||||
int r = uart_readn(UART0, (uint8_t *)buf, len);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// Send characters to UART
|
||||
int board_uart_write(void const *buf, int len)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-qual" // uart_writen does not have const for buffer parameter.
|
||||
int r = uart_writen(UART0, (uint8_t *)((const void *)buf), len);
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// Get current milliseconds
|
||||
uint32_t board_millis(void)
|
||||
{
|
||||
uint32_t safe_ms;
|
||||
|
||||
CRITICAL_SECTION_BEGIN
|
||||
safe_ms = timer_ms;
|
||||
CRITICAL_SECTION_END
|
||||
|
||||
return safe_ms;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
# GCC prefix for FT90X compile tools.
|
||||
CROSS_COMPILE = ft32-elf-
|
||||
SKIP_NANOLIB = 1
|
||||
|
||||
# Set to use FT90X prebuilt libraries.
|
||||
FT90X_PREBUILT_LIBS = 0
|
||||
ifeq ($(FT90X_PREBUILT_LIBS),1)
|
||||
# If the FT90X toolchain is installed on Windows systems then the SDK
|
||||
# include files and prebuilt libraries are at: %FT90X_TOOLCHAIN%/hardware
|
||||
FT9XX_SDK = $(FT90X_TOOLCHAIN)/hardware
|
||||
INC += $(FT9XX_SDK)/include
|
||||
else
|
||||
# The submodule BRTSG-FOSS/ft90x-sdk contains header files and source
|
||||
# code for the Bridgetek SDK. This can be used instead of the prebuilt
|
||||
# library.
|
||||
DEPS_SUBMODULES += hw/mcu/bridgetek/ft9xx/ft90x-sdk
|
||||
# The SDK can be used to load specific files from the Bridgetek SDK.
|
||||
FT9XX_SDK = hw/mcu/bridgetek/ft9xx/ft90x-sdk/Source
|
||||
INC += $(TOP)/$(FT9XX_SDK)/include
|
||||
endif
|
||||
|
||||
# Add include files which are within the TinyUSB directory structure.
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH)
|
||||
|
||||
# Add required C Compiler flags for FT90X.
|
||||
CFLAGS += \
|
||||
-D__FT900__ \
|
||||
-fvar-tracking \
|
||||
-fvar-tracking-assignments \
|
||||
-fmessage-length=0 \
|
||||
-ffunction-sections \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_FT90X
|
||||
|
||||
# lwip/src/core/raw.c:334:43: error: declaration of 'recv' shadows a global declaration
|
||||
CFLAGS += -Wno-error=shadow
|
||||
|
||||
# Add include files outside the TinyUSB structure that are added manually.
|
||||
CFLAGS += -I"$(FT9XX_SDK)/include"
|
||||
|
||||
# Set Linker flags.
|
||||
LD_FILE = hw/mcu/bridgetek/ft9xx/scripts/ldscript.ld
|
||||
LDFLAGS += $(addprefix -L,$(LDINC)) \
|
||||
-Xlinker --entry=_start \
|
||||
-Wl,-lc
|
||||
|
||||
# Additional Source files for FT90X.
|
||||
SRC_C += src/portable/bridgetek/ft9xx/dcd_ft9xx.c
|
||||
|
||||
# Linker library.
|
||||
ifneq ($(FT90X_PREBUILT_LIBS),1)
|
||||
# Optionally add in files from the Bridgetek SDK instead of the prebuilt
|
||||
# library. These are the minimum required.
|
||||
SRC_C += $(FT9XX_SDK)/src/sys.c
|
||||
SRC_C += $(FT9XX_SDK)/src/interrupt.c
|
||||
SRC_C += $(FT9XX_SDK)/src/delay.c
|
||||
SRC_C += $(FT9XX_SDK)/src/timers.c
|
||||
SRC_C += $(FT9XX_SDK)/src/uart_simple.c
|
||||
SRC_C += $(FT9XX_SDK)/src/gpio.c
|
||||
else
|
||||
# Or if using the prebuilt libraries add them.
|
||||
LDFLAGS += -L"$(FT9XX_SDK)/lib"
|
||||
LIBS += -lft900
|
||||
endif
|
||||
|
||||
# Not required crt0 file for FT90X. Use compiler built-in file.
|
||||
#SRC_S += hw/mcu/bridgetek/ft9xx/scripts/crt0.S
|
||||
@@ -70,7 +70,7 @@ void board_init(void)
|
||||
#endif
|
||||
|
||||
// Button
|
||||
gpio_pad_select_gpio(BUTTON_PIN);
|
||||
esp_rom_gpio_pad_select_gpio(BUTTON_PIN);
|
||||
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
|
||||
gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY);
|
||||
|
||||
@@ -98,7 +98,12 @@ static void configure_pins(usb_hal_context_t *usb)
|
||||
esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false);
|
||||
} else {
|
||||
esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false);
|
||||
if ((iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH)) {
|
||||
#if ESP_IDF_VERSION_MAJOR > 4
|
||||
if ((iopin->pin != GPIO_MATRIX_CONST_ZERO_INPUT) && (iopin->pin != GPIO_MATRIX_CONST_ONE_INPUT))
|
||||
#else
|
||||
if ((iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH))
|
||||
#endif
|
||||
{
|
||||
gpio_ll_input_enable(&GPIO, iopin->pin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void board_init(void)
|
||||
#endif
|
||||
|
||||
// Button
|
||||
gpio_pad_select_gpio(BUTTON_PIN);
|
||||
esp_rom_gpio_pad_select_gpio(BUTTON_PIN);
|
||||
gpio_set_direction(BUTTON_PIN, GPIO_MODE_INPUT);
|
||||
gpio_set_pull_mode(BUTTON_PIN, BUTTON_STATE_ACTIVE ? GPIO_PULLDOWN_ONLY : GPIO_PULLUP_ONLY);
|
||||
|
||||
@@ -98,7 +98,12 @@ static void configure_pins(usb_hal_context_t *usb)
|
||||
esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false);
|
||||
} else {
|
||||
esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false);
|
||||
if ((iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH)) {
|
||||
#if ESP_IDF_VERSION_MAJOR > 4
|
||||
if ((iopin->pin != GPIO_MATRIX_CONST_ZERO_INPUT) && (iopin->pin != GPIO_MATRIX_CONST_ONE_INPUT))
|
||||
#else
|
||||
if ((iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH))
|
||||
#endif
|
||||
{
|
||||
gpio_ll_input_enable(&GPIO, iopin->pin);
|
||||
}
|
||||
}
|
||||
|
||||
+42
-13
@@ -11,23 +11,52 @@ if (NOT TARGET _family_support_marker)
|
||||
|
||||
function(family_filter RESULT DIR)
|
||||
get_filename_component(DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
file(GLOB ONLYS "${DIR}/.only.MCU_*")
|
||||
if (ONLYS)
|
||||
|
||||
if (EXISTS "${DIR}/only.txt")
|
||||
file(READ "${DIR}/only.txt" ONLYS)
|
||||
# Replace newlines with semicolon so that it is treated as a list by CMake
|
||||
string(REPLACE "\n" ";" ONLYS_LINES ${ONLYS})
|
||||
# For each mcu
|
||||
foreach(MCU IN LISTS FAMILY_MCUS)
|
||||
if (EXISTS ${DIR}/.only.MCU_${MCU})
|
||||
set(${RESULT} 1 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
# For each line in only.txt
|
||||
foreach(_line ${ONLYS_LINES})
|
||||
# If mcu:xxx exists for this mcu then include
|
||||
if (${_line} STREQUAL "mcu:${MCU}")
|
||||
set(${RESULT} 1 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Didn't find it in only file so don't build
|
||||
set(${RESULT} 0 PARENT_SCOPE)
|
||||
|
||||
elseif (EXISTS "${DIR}/skip.txt")
|
||||
file(READ "${DIR}/skip.txt" SKIPS)
|
||||
# Replace newlines with semicolon so that it is treated as a list by CMake
|
||||
string(REPLACE "\n" ";" SKIPS_LINES ${SKIPS})
|
||||
# For each mcu
|
||||
foreach(MCU IN LISTS FAMILY_MCUS)
|
||||
# For each line in only.txt
|
||||
foreach(_line ${SKIPS_LINES})
|
||||
# If mcu:xxx exists for this mcu then skip
|
||||
if (${_line} STREQUAL "mcu:${MCU}")
|
||||
set(${RESULT} 0 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Didn't find in skip file so build
|
||||
set(${RESULT} 1 PARENT_SCOPE)
|
||||
|
||||
else()
|
||||
foreach(MCU IN LISTS FAMILY_MCUS)
|
||||
if (EXISTS ${DIR}/.skip.MCU_${MCU})
|
||||
set(${RESULT} 0 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Didn't find skip or only file so build
|
||||
set(${RESULT} 1 PARENT_SCOPE)
|
||||
|
||||
endif()
|
||||
set(${RESULT} 1 PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(family_add_subdirectory DIR)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
JLINK_DEVICE=PIC32MZ2048EFH064
|
||||
JLINK_IF=ICSP
|
||||
|
||||
CFLAGS += \
|
||||
-mprocessor=32MZ2048EFH064 \
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Jerzy Kasenberg
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <xc.h>
|
||||
#include "tusb.h"
|
||||
|
||||
/* JTAG on, WDT off */
|
||||
#pragma config FDMTEN=0, FSOSCEN=0, DMTCNT=1
|
||||
#pragma config DEBUG=ON
|
||||
#pragma config JTAGEN=ON
|
||||
#pragma config FSLEEP=OFF
|
||||
#pragma config TRCEN=OFF
|
||||
#pragma config ICESEL=ICS_PGx2
|
||||
|
||||
#pragma config POSCMOD = EC
|
||||
#pragma config FNOSC = SPLL
|
||||
/* 24MHz posc input to pll, div by 3, multiply by 50, div by 2 -> 200mhz*/
|
||||
#pragma config FPLLICLK=0, FPLLIDIV=DIV_3, FPLLRNG=RANGE_5_10_MHZ, FPLLMULT=MUL_50, FPLLODIV=DIV_2
|
||||
#pragma config FUSBIDIO=1
|
||||
#pragma config WINDIS=NORMAL
|
||||
#pragma config WDTSPGM=1
|
||||
#pragma config WDTPS=15
|
||||
#pragma config FWDTEN=OFF
|
||||
|
||||
void button_init(void)
|
||||
{
|
||||
// RB12 - button
|
||||
// ANSELB B12 not analog
|
||||
ANSELBCLR = TU_BIT(12);
|
||||
// TRISB B12 input
|
||||
TRISBSET = TU_BIT(12);
|
||||
// Pull-up
|
||||
CNPUBSET = TU_BIT(12);
|
||||
}
|
||||
|
||||
void led_init(void)
|
||||
{
|
||||
// RB8 - LED
|
||||
// ANASELB RB8 not analog
|
||||
ANSELBCLR = TU_BIT(8);
|
||||
// TRISH RH2 output
|
||||
TRISBCLR = TU_BIT(8);
|
||||
// Initial value 0, LED off
|
||||
LATBCLR = TU_BIT(8);
|
||||
}
|
||||
|
||||
void uart_init(void)
|
||||
{
|
||||
// RD4/RD0 Uart4 TX/RX
|
||||
// ANSELD - not present on 64 pin device
|
||||
|
||||
/* Unlock system for PPS configuration */
|
||||
SYSKEY = 0x00000000;
|
||||
SYSKEY = 0xAA996655;
|
||||
SYSKEY = 0x556699AA;
|
||||
CFGCONbits.IOLOCK = 0;
|
||||
|
||||
// PPS Input Remapping
|
||||
// U4RX -> RD0
|
||||
U4RXR = 3;
|
||||
|
||||
// PPS Output Remapping
|
||||
// RD4 -> U4TX
|
||||
RPD4R = 2;
|
||||
|
||||
// Lock back the system after PPS configuration
|
||||
CFGCONbits.IOLOCK = 1;
|
||||
SYSKEY = 0x00000000;
|
||||
|
||||
// UART4
|
||||
// High speed mode
|
||||
// 8 bits, no parity, no RTS/CTS, no flow control
|
||||
U4MODE = 0x0;
|
||||
|
||||
// Enable UART2 Receiver and Transmitter
|
||||
U4STASET = (_U4STA_UTXEN_MASK | _U4STA_URXEN_MASK | _U4STA_UTXISEL1_MASK);
|
||||
|
||||
// BAUD Rate register Setup
|
||||
U4BRG = 100000000 / (16 * 115200) + 1;
|
||||
|
||||
// Disable Interrupts
|
||||
IEC4CLR = _IEC5_U4EIE_MASK | _IEC5_U4RXIE_MASK | _IEC5_U4TXIE_MASK;
|
||||
|
||||
// Turn ON UART2
|
||||
U4MODESET = _U4MODE_ON_MASK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
LATBSET = TU_BIT(8);
|
||||
}
|
||||
else
|
||||
{
|
||||
LATBCLR = TU_BIT(8);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
return ((PORTB >> 12) & 1) == 0;
|
||||
}
|
||||
|
||||
int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
int i = len;
|
||||
uint8_t const * data = buf;
|
||||
while (i--)
|
||||
{
|
||||
while (U4STAbits.UTXBF) ;
|
||||
U4TXREG = *data++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
JLINK_DEVICE=PIC32MZ2048EFM144
|
||||
JLINK_IF=ICSP
|
||||
|
||||
CFLAGS += \
|
||||
-mprocessor=32MZ2048EFM144 \
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Jerzy Kasenberg
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <xc.h>
|
||||
#include "tusb.h"
|
||||
|
||||
/* JTAG on, WDT off */
|
||||
#pragma config FDMTEN=0, FSOSCEN=0, DMTCNT=1
|
||||
#pragma config DEBUG=ON
|
||||
#pragma config JTAGEN=ON
|
||||
#pragma config FSLEEP=OFF
|
||||
#pragma config TRCEN=OFF
|
||||
#pragma config ICESEL=ICS_PGx2
|
||||
|
||||
#pragma config POSCMOD = HS
|
||||
#pragma config FNOSC = SPLL
|
||||
/* 24MHz posc input to pll, div by 3, multiply by 50, div by 2 -> 200mhz*/
|
||||
#pragma config FPLLICLK=0, FPLLIDIV=DIV_3, FPLLRNG=RANGE_5_10_MHZ, FPLLMULT=MUL_50, FPLLODIV=DIV_2
|
||||
#pragma config FUSBIDIO=1
|
||||
#pragma config WINDIS=NORMAL
|
||||
#pragma config WDTSPGM=1
|
||||
#pragma config WDTPS=15
|
||||
#pragma config FWDTEN=OFF
|
||||
|
||||
void button_init(void)
|
||||
{
|
||||
// RB12 - button
|
||||
// ANSELB B12 not analog
|
||||
ANSELBCLR = TU_BIT(12);
|
||||
// TRISB B12 input
|
||||
TRISBSET = TU_BIT(12);
|
||||
}
|
||||
|
||||
void led_init(void)
|
||||
{
|
||||
// RH2 - LED
|
||||
// ANASELH no analog function on RH2
|
||||
// TRISH RH2 output
|
||||
TRISHCLR = TU_BIT(2);
|
||||
// Initial value 0, LED off
|
||||
LATHCLR = TU_BIT(2);
|
||||
}
|
||||
|
||||
void uart_init(void)
|
||||
{
|
||||
// RE8/RE9 Uart2 TX/RX
|
||||
// ANSELE - TX/RX not analog
|
||||
ANSELECLR = TU_BIT(8) | TU_BIT(9);
|
||||
|
||||
/* Unlock system for PPS configuration */
|
||||
SYSKEY = 0x00000000;
|
||||
SYSKEY = 0xAA996655;
|
||||
SYSKEY = 0x556699AA;
|
||||
CFGCONbits.IOLOCK = 0;
|
||||
|
||||
// PPS Input Remapping
|
||||
// U2RX -> RE9
|
||||
U2RXR = 13;
|
||||
|
||||
// PPS Output Remapping
|
||||
// RE8 -> U2TX
|
||||
RPE8R = 2;
|
||||
|
||||
// Lock back the system after PPS configuration
|
||||
CFGCONbits.IOLOCK = 1;
|
||||
SYSKEY = 0x00000000;
|
||||
|
||||
// UART2
|
||||
// High speed mode
|
||||
// 8 bits, no parity, no RTS/CTS, no flow control
|
||||
U2MODE = 0x0;
|
||||
|
||||
// Enable UART2 Receiver and Transmitter
|
||||
U2STASET = (_U2STA_UTXEN_MASK | _U2STA_URXEN_MASK | _U2STA_UTXISEL1_MASK);
|
||||
|
||||
// BAUD Rate register Setup
|
||||
U2BRG = 100000000 / (16 * 115200) + 1;
|
||||
|
||||
// Disable Interrupts
|
||||
IEC4CLR = _IEC4_U2EIE_MASK | _IEC4_U2RXIE_MASK | _IEC4_U2TXIE_MASK;
|
||||
|
||||
// Turn ON UART2
|
||||
U2MODESET = _U2MODE_ON_MASK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
LATHSET = TU_BIT(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LATHCLR = TU_BIT(2);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
return ((PORTB >> 12) & 1) == 0;
|
||||
}
|
||||
|
||||
int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
int i = len;
|
||||
uint8_t const * data = buf;
|
||||
while (i--)
|
||||
{
|
||||
while (U2STAbits.UTXBF) ;
|
||||
U2TXREG = *data++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Jerzy Kasenberg
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <xc.h>
|
||||
#include "tusb.h"
|
||||
|
||||
void __attribute__((interrupt(IPL2AUTO), vector(_USB_VECTOR), no_fpu))
|
||||
USBD_IRQHandler(void)
|
||||
{
|
||||
IFS4CLR = _IFS4_USBIF_MASK;
|
||||
tud_int_handler(0);
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK void button_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK void led_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK void uart_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
button_init();
|
||||
led_init();
|
||||
uart_init();
|
||||
|
||||
// Force device mode by overriding USB ID and settings it to 1
|
||||
USBCRCONbits.PHYIDEN = 0;
|
||||
USBCRCONbits.USBIDVAL = 1;
|
||||
USBCRCONbits.USBIDOVEN = 1;
|
||||
|
||||
// set interrupt priority (must much IPL2AUTO)
|
||||
IPC33CLR = _IPC33_USBIP_MASK;
|
||||
IPC33SET = (2 << _IPC33_USBIP_POSITION);
|
||||
// set interrupt subpriority
|
||||
IPC33CLR = _IPC33_USBIS_MASK;
|
||||
IPC33SET = (0 << _IPC33_USBIS_POSITION);
|
||||
|
||||
USBCRCONbits.USBIE = 0;
|
||||
IFS4CLR = _IFS4_USBIF_MASK;
|
||||
IEC4SET = _IEC4_USBIE_MASK;
|
||||
|
||||
__builtin_enable_interrupts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
TU_ATTR_WEAK void board_led_write(bool state)
|
||||
{
|
||||
(void) state;
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK uint32_t board_button_read(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK int board_uart_read(uint8_t * buf, int len)
|
||||
{
|
||||
(void) buf;
|
||||
(void) len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
TU_ATTR_WEAK int board_uart_write(void const * buf, int len)
|
||||
{
|
||||
(void) buf;
|
||||
return len;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
uint32_t board_millis(void)
|
||||
{
|
||||
// COUNTER is system clock (200MHz / 2 = 100MHz) convert to ms)
|
||||
return _CP0_GET_COUNT() / (100000000 / 1000);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
CROSS_COMPILE = xc32-
|
||||
CFLAGS_OPTIMIZED = -O2
|
||||
LIBS_GCC = -lgcc -lm
|
||||
SKIP_NANOLIB = 1
|
||||
|
||||
CFLAGS = \
|
||||
-std=c99 \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_PIC32MZ
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
SRC_C += \
|
||||
src/portable/microchip/pic32mz/dcd_pic32mz.c \
|
||||
|
||||
INC += \
|
||||
$(TOP)/hw/mcu/microchip/pic32mz \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
|
||||
# flash target using jlink
|
||||
flash: flash-jlink
|
||||
@@ -1 +0,0 @@
|
||||
CFLAGS += -DBCM_VERSION=2711
|
||||
@@ -1,5 +1,5 @@
|
||||
__USTACK_SIZE = 0x00000400;
|
||||
__ISTACK_SIZE = 0x00000400;
|
||||
__USTACK_SIZE = 0x00000800;
|
||||
__ISTACK_SIZE = 0x00000800;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
||||
@@ -176,7 +176,12 @@ void INT_Excep_SCI5_RXI5(void)
|
||||
//--------------------------------------------------------------------+
|
||||
void INT_Excep_USB0_USBI0(void)
|
||||
{
|
||||
#if TUSB_OPT_HOST_ENABLED
|
||||
tuh_int_handler(0);
|
||||
#endif
|
||||
#if TUSB_OPT_DEVICE_ENABLED
|
||||
tud_int_handler(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void board_init(void)
|
||||
|
||||
@@ -15,6 +15,7 @@ CFLAGS += \
|
||||
|
||||
SRC_C += \
|
||||
src/portable/renesas/usba/dcd_usba.c \
|
||||
src/portable/renesas/usba/hcd_usba.c \
|
||||
$(MCU_DIR)/vects.c
|
||||
|
||||
INC += \
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# BridgeTek FT9xx MCU
|
||||
|
||||
**BridgeTek** provides a hardware abstraction library with software source code for the SDKs for FT9xx software family.
|
||||
|
||||
Whole SDK repository is installed as part of the FT9xx Toolchain and can be downloaded from BridgeTek web page `https://www.brtchip.com`.
|
||||
|
||||
Registers definition files, and included peripheral register definition files have licenses that allow for redistribution.
|
||||
Submodule
+1
Submodule hw/mcu/bridgetek/ft9xx/ft90x-sdk added at e8122eb6bd
@@ -0,0 +1,286 @@
|
||||
.equ SYS_REGMSC0CFG_B3 , 0x1001b
|
||||
.equ SYS_REGIRQCTL_B3 , 0x100e3
|
||||
.equ MAILBOX_MEMORY , 0x13000
|
||||
|
||||
.equ IS_IMG_SDBL_PRESENT, 0
|
||||
.equ IS_IMG_D2XX_PRESENT, 0
|
||||
.equ IS_IMG_DLOG_PRESENT, 0
|
||||
|
||||
.section .crt0
|
||||
.global _start
|
||||
|
||||
_start:
|
||||
# START Interrupt Vector Table [[
|
||||
jmp __PMSIZE-4 # RESET Vector
|
||||
jmp interrupt_33 # Watchdog reset vector
|
||||
jmp interrupt_0
|
||||
jmp interrupt_1
|
||||
jmp interrupt_2
|
||||
jmp interrupt_3
|
||||
jmp interrupt_4
|
||||
jmp interrupt_5
|
||||
jmp interrupt_6
|
||||
jmp interrupt_7
|
||||
jmp interrupt_8
|
||||
jmp interrupt_9
|
||||
jmp interrupt_10
|
||||
jmp interrupt_11
|
||||
jmp interrupt_12
|
||||
jmp interrupt_13
|
||||
jmp interrupt_14
|
||||
jmp interrupt_15
|
||||
jmp interrupt_16
|
||||
jmp interrupt_17
|
||||
jmp interrupt_18
|
||||
jmp interrupt_19
|
||||
jmp interrupt_20
|
||||
jmp interrupt_21
|
||||
jmp interrupt_22
|
||||
jmp interrupt_23
|
||||
jmp interrupt_24
|
||||
jmp interrupt_25
|
||||
jmp interrupt_26
|
||||
jmp interrupt_27
|
||||
jmp interrupt_28
|
||||
jmp interrupt_29
|
||||
jmp interrupt_30
|
||||
jmp interrupt_31
|
||||
jmp __PMSIZE-8 #Interrupt vector 32 (NMI)
|
||||
# ]] END Interrupt Vector Table
|
||||
|
||||
codestart:
|
||||
jmp init
|
||||
|
||||
.global _exithook
|
||||
_exithook: # Debugger uses '_exithook' at 0x90 to catch program exit
|
||||
return
|
||||
|
||||
init:
|
||||
# Disable all interrupts
|
||||
ldk $r0,0x80
|
||||
.ifdef __FT930__
|
||||
sta.b 0x10123, $r0
|
||||
.else
|
||||
sta.b 0x100e3,$r0
|
||||
.endif
|
||||
|
||||
# Reset all peripherals
|
||||
# lda.l $r0, 0x10018
|
||||
# bins.l $r0, $r0, 0x23F # Set bit 31
|
||||
# sta.l 0x10018, $r0
|
||||
|
||||
# Initialize DATA by copying from program memory
|
||||
ldk.l $r0,__data_load_start
|
||||
ldk.l $r1,__data_load_end
|
||||
ldk.l $r2,0 # Will use __data after binutils patch
|
||||
|
||||
jmp .dscopy
|
||||
.dsloop:
|
||||
# Copy PM[$r0] to RAM $r2
|
||||
lpmi.l $r3,$r0,0
|
||||
sti.l $r2,0,$r3
|
||||
add.l $r0,$r0,4
|
||||
add.l $r2,$r2,4
|
||||
.dscopy:
|
||||
cmp.l $r0,$r1
|
||||
jmpc lt,.dsloop
|
||||
|
||||
# Zero BSS
|
||||
ldk.l $r0,_bss_start
|
||||
ldk.l $r2,_end
|
||||
sub.l $r2,$r2,$r0
|
||||
ldk.l $r1,0
|
||||
ldk $r3,32764
|
||||
1:
|
||||
cmp $r2,$r3
|
||||
jmpc lt,2f
|
||||
memset $r0,$r1,$r3
|
||||
add $r0,$r0,$r3
|
||||
sub $r2,$r2,$r3
|
||||
jmp 1b
|
||||
2:
|
||||
memset $r0,$r1,$r2
|
||||
.ifdef __FT930__
|
||||
/*##############################################################*/
|
||||
# copy UserConfig DATA from flash to mailbox memory
|
||||
/*##############################################################*/
|
||||
ldk.l $r0,D2XX_Struct_start /*start of d2xx config in PM memory */
|
||||
ldk.l $r1,D2XX_Struct_end /*end of d2xx config in PM memory */
|
||||
ldk.l $r2,D2XXTEST_UserD2xxConfig /* RAM cache where the d2xx config from PM to be copied*/
|
||||
jmp .configcopy
|
||||
|
||||
.configloop:
|
||||
# Copy PM[$r0] to RAM[$r2]
|
||||
lpmi.l $r3,$r0,0
|
||||
sti.l $r2,0,$r3
|
||||
# Increment
|
||||
add.l $r0,$r0,4
|
||||
add.l $r2,$r2,4
|
||||
.configcopy:
|
||||
cmp.l $r0,$r1
|
||||
jmpc lt,.configloop
|
||||
|
||||
ldk.l $r1,D2XX_Struct_start
|
||||
ldk.l $r2,D2XX_Struct_end
|
||||
#compute size
|
||||
sub.l $r2,$r2,$r1
|
||||
ldk.l $r1,D2XXTEST_UserD2xxConfig
|
||||
ldk.l $r0,MAILBOX_MEMORY /* D2xx config from RAM cache to be copied to Mailbox memory */
|
||||
# Copy RAM[$r1] to Mailbox $r0, for $r2 bytes
|
||||
streamouti.b $r0,$r1,$r2
|
||||
/*############################################################*/
|
||||
.endif
|
||||
sub.l $sp,$sp,24 # Space for the caller argument frame
|
||||
call main
|
||||
|
||||
.equ EXITEXIT , 0x1fffc
|
||||
|
||||
.global _exit
|
||||
_exit:
|
||||
sta.l EXITEXIT,$r0 # simulator end of test
|
||||
jmp _exithook
|
||||
|
||||
#_watchdog_isr:
|
||||
# ldk $sp,__RAMSIZE
|
||||
# jmp __PMSIZE-4
|
||||
|
||||
# Macro to construct the interrupt stub code.
|
||||
# it just saves r0, loads r0 with the int vector
|
||||
# and branches to interrupt_common.
|
||||
|
||||
.macro inth i=0
|
||||
interrupt_\i:
|
||||
push $r0 # {
|
||||
lda $r0,(vector_table + 4 * \i)
|
||||
jmp interrupt_common
|
||||
.endm
|
||||
|
||||
inth 0
|
||||
inth 1
|
||||
inth 2
|
||||
inth 3
|
||||
inth 4
|
||||
inth 5
|
||||
inth 6
|
||||
inth 7
|
||||
inth 8
|
||||
inth 9
|
||||
inth 10
|
||||
inth 11
|
||||
inth 12
|
||||
inth 13
|
||||
inth 14
|
||||
inth 15
|
||||
inth 16
|
||||
inth 17
|
||||
inth 18
|
||||
inth 19
|
||||
inth 20
|
||||
inth 21
|
||||
inth 22
|
||||
inth 23
|
||||
inth 24
|
||||
inth 25
|
||||
inth 26
|
||||
inth 27
|
||||
inth 28
|
||||
inth 29
|
||||
inth 30
|
||||
inth 31
|
||||
inth 32
|
||||
inth 33
|
||||
|
||||
# On entry: r0, already saved, holds the handler function
|
||||
interrupt_common:
|
||||
push $r1 # {
|
||||
push $r2 # {
|
||||
push $r3 # {
|
||||
push $r4 # {
|
||||
push $r5 # {
|
||||
push $r6 # {
|
||||
push $r7 # {
|
||||
push $r8 # {
|
||||
push $r9 # {
|
||||
push $r10 # {
|
||||
push $r11 # {
|
||||
push $r12 # {
|
||||
push $cc # {
|
||||
|
||||
calli $r0
|
||||
|
||||
pop $cc # }
|
||||
pop $r12 # }
|
||||
pop $r11 # }
|
||||
pop $r10 # }
|
||||
pop $r9 # }
|
||||
pop $r8 # }
|
||||
pop $r7 # }
|
||||
pop $r6 # }
|
||||
pop $r5 # }
|
||||
pop $r4 # }
|
||||
pop $r3 # }
|
||||
pop $r2 # }
|
||||
pop $r1 # }
|
||||
pop $r0 # } matching push in interrupt_0-31 above
|
||||
reti
|
||||
|
||||
# Null function for unassigned interrupt to point at
|
||||
.global nullvector
|
||||
nullvector:
|
||||
return
|
||||
|
||||
.section .data
|
||||
.global vector_table
|
||||
.align (4) # assembler alignment is in the power of 2 (in this case 2^4)
|
||||
vector_table:
|
||||
.rept 34
|
||||
.long nullvector
|
||||
.endr
|
||||
|
||||
|
||||
.section .text
|
||||
.global __gxx_personality_sj0
|
||||
__gxx_personality_sj0:
|
||||
|
||||
|
||||
.section ._flash_d2xx_config
|
||||
.global __pD2XXDefaultConfiguration
|
||||
.align (10)
|
||||
|
||||
D2XX_partition_start = .
|
||||
|
||||
.if IS_IMG_D2XX_PRESENT
|
||||
.ifdef __FT930__
|
||||
.include "ft930_d2xx_default_config.inc"
|
||||
.else
|
||||
.include "ft900_d2xx_default_config.inc"
|
||||
.endif
|
||||
.endif
|
||||
|
||||
D2XX_partition_end = .
|
||||
|
||||
.section ._flash_dlog_partition
|
||||
.align (10)
|
||||
.global __dlog_partition
|
||||
__dlog_partition:
|
||||
dlog_partition_start = .
|
||||
.if IS_IMG_DLOG_PRESENT
|
||||
.long 0xF7D1D106
|
||||
.rept (0x1000-4)
|
||||
.byte 0xFF
|
||||
.endr
|
||||
.endif
|
||||
dlog_partition_end = .
|
||||
|
||||
.section ._pm
|
||||
.global __sdbl_partition_sizeof
|
||||
.global __D2XX_partition_sizeof
|
||||
.global __dlog_partition_sizeof
|
||||
.if IS_IMG_SDBL_PRESENT
|
||||
__sdbl_partition_sizeof = 0x2000
|
||||
.else
|
||||
__sdbl_partition_sizeof = 0
|
||||
.endif
|
||||
|
||||
__D2XX_partition_sizeof = D2XX_partition_end - D2XX_partition_start
|
||||
__dlog_partition_sizeof = dlog_partition_end - dlog_partition_start
|
||||
@@ -0,0 +1,95 @@
|
||||
/* Default linker script, for normal executables */
|
||||
OUTPUT_FORMAT("elf32-ft32")
|
||||
OUTPUT_ARCH(ft32)
|
||||
SEARCH_DIR("/data/win8/ft32/ft32-elf/lib");
|
||||
/* Allow the command line to override the memory region sizes. */
|
||||
__PMSIZE = DEFINED(__PMSIZE) ? __PMSIZE : 256K;
|
||||
__RAMSIZE = DEFINED(__RAMSIZE) ? __RAMSIZE : 64K;
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0, LENGTH = __PMSIZE
|
||||
ram (rw!x) : ORIGIN = 0x800000, LENGTH = __RAMSIZE
|
||||
ehci_mmap (rw!x) : ORIGIN = 0x811000, LENGTH = 2K
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
*(.text*)
|
||||
*(.strings)
|
||||
*(._pm*)
|
||||
*(.init)
|
||||
*(.fini)
|
||||
_etext = . ;
|
||||
. = ALIGN(4);
|
||||
} > flash
|
||||
.tors :
|
||||
{
|
||||
___ctors = . ;
|
||||
*(.ctors)
|
||||
___ctors_end = . ;
|
||||
___dtors = . ;
|
||||
*(.dtors)
|
||||
___dtors_end = . ;
|
||||
. = ALIGN(4);
|
||||
} > ram
|
||||
.data : AT (ADDR (.text) + SIZEOF (.text))
|
||||
{
|
||||
*(.data)
|
||||
*(.data*)
|
||||
*(.rodata)
|
||||
*(.rodata*)
|
||||
_edata = . ;
|
||||
. = ALIGN(4);
|
||||
} > ram
|
||||
.bss SIZEOF(.data) + ADDR(.data) :
|
||||
{
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
_end = . ;
|
||||
. = ALIGN(4);
|
||||
} > ram
|
||||
__data_load_start = LOADADDR(.data);
|
||||
__data_load_end = __data_load_start + SIZEOF(.data);
|
||||
.stab 0 (NOLOAD) :
|
||||
{
|
||||
*(.stab)
|
||||
}
|
||||
.stabstr 0 (NOLOAD) :
|
||||
{
|
||||
*(.stabstr)
|
||||
}
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* DWARF Extension. */
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
}
|
||||
+1
-1
Submodule hw/mcu/broadcom updated: 5bff1d5e02...0837008608
Reference in New Issue
Block a user