Initial project setup
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* 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. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
#include "DA1469xAB.h"
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE (1024)
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configRECORD_STACK_HIGH_ADDRESS 1
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in mcu header
|
||||
#define configPRIO_BITS 4
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
set(JLINK_DEVICE DA14695)
|
||||
|
||||
function(update_board TARGET)
|
||||
endfunction()
|
||||
@@ -0,0 +1,15 @@
|
||||
/* metadata:
|
||||
name: DA14695-00HQDEVKT-U
|
||||
url: https://www.renesas.com/en/products/wireless-connectivity/bluetooth-low-energy/da14695-00hqdevkt-u-smartbond-da14695-bluetooth-low-energy-52-usb-development-kit
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#define LED_PIN 33 // P1.1
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
#define BUTTON_PIN 6
|
||||
#define BUTTON_STATE_ACTIVE 1
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1 @@
|
||||
JLINK_DEVICE = DA14695
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.9.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_SYSCFG_
|
||||
#define H_MYNEWT_SYSCFG_
|
||||
|
||||
/**
|
||||
* This macro exists to ensure code includes this header when needed. If code
|
||||
* checks the existence of a setting directly via ifdef without including this
|
||||
* header, the setting macro will silently evaluate to 0. In contrast, an
|
||||
* attempt to use these macros without including this header will result in a
|
||||
* compiler error.
|
||||
*/
|
||||
#define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name
|
||||
#define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val
|
||||
|
||||
#ifndef MYNEWT_VAL_RAM_RESIDENT
|
||||
#define MYNEWT_VAL_RAM_RESIDENT (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_GPIO_MAX_IRQ
|
||||
#define MYNEWT_VAL_MCU_GPIO_MAX_IRQ (4)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_GPIO_RETAINABLE_NUM
|
||||
#define MYNEWT_VAL_MCU_GPIO_RETAINABLE_NUM (-1)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_CLOCK_XTAL32M_SETTLE_TIME_US
|
||||
#define MYNEWT_VAL_MCU_CLOCK_XTAL32M_SETTLE_TIME_US (2000)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,4 @@
|
||||
set(JLINK_DEVICE DA14699)
|
||||
|
||||
function(update_board TARGET)
|
||||
endfunction()
|
||||
@@ -0,0 +1,17 @@
|
||||
/* metadata:
|
||||
name: DA1469x Development Kit Pro
|
||||
url: https://lpccs-docs.renesas.com/um-b-090-da1469x_getting_started/DA1469x_The_hardware/DA1469x_The_hardware.html
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#define LED_PIN 33
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
#define BUTTON_PIN 6
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
#define NEED_VBUS_MONITOR
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = DA14699
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* This file was generated by Apache newt version: 1.9.0-dev
|
||||
*/
|
||||
|
||||
#ifndef H_MYNEWT_SYSCFG_
|
||||
#define H_MYNEWT_SYSCFG_
|
||||
|
||||
/**
|
||||
* This macro exists to ensure code includes this header when needed. If code
|
||||
* checks the existence of a setting directly via ifdef without including this
|
||||
* header, the setting macro will silently evaluate to 0. In contrast, an
|
||||
* attempt to use these macros without including this header will result in a
|
||||
* compiler error.
|
||||
*/
|
||||
#define MYNEWT_VAL(_name) MYNEWT_VAL_ ## _name
|
||||
#define MYNEWT_VAL_CHOICE(_name, _val) MYNEWT_VAL_ ## _name ## __ ## _val
|
||||
|
||||
#ifndef MYNEWT_VAL_RAM_RESIDENT
|
||||
#define MYNEWT_VAL_RAM_RESIDENT (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_GPIO_MAX_IRQ
|
||||
#define MYNEWT_VAL_MCU_GPIO_MAX_IRQ (4)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_GPIO_RETAINABLE_NUM
|
||||
#define MYNEWT_VAL_MCU_GPIO_RETAINABLE_NUM (-1)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_MCU_CLOCK_XTAL32M_SETTLE_TIME_US
|
||||
#define MYNEWT_VAL_MCU_CLOCK_XTAL32M_SETTLE_TIME_US (2000)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
146
managed_components/espressif__tinyusb/hw/bsp/da1469x/family.c
Normal file
146
managed_components/espressif__tinyusb/hw/bsp/da1469x/family.c
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 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.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
manufacturer: Renesas
|
||||
*/
|
||||
|
||||
#include "bsp/board_api.h"
|
||||
#include "board.h"
|
||||
#include <hal/hal_gpio.h>
|
||||
#include <mcu/mcu.h>
|
||||
|
||||
#define LED_STATE_OFF (1-LED_STATE_ON)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
void USB_IRQHandler(void) {
|
||||
tud_int_handler(0);
|
||||
}
|
||||
|
||||
// DA146xx driver function that must be called whenever VBUS changes.
|
||||
extern void tusb_vbus_changed(bool present);
|
||||
|
||||
#if defined(NEED_VBUS_MONITOR) && CFG_TUD_ENABLED
|
||||
// VBUS change interrupt handler
|
||||
void VBUS_IRQHandler(void) {
|
||||
bool present = (CRG_TOP->ANA_STATUS_REG & CRG_TOP_ANA_STATUS_REG_VBUS_AVAILABLE_Msk) != 0;
|
||||
// Clear VBUS interrupt
|
||||
CRG_TOP->VBUS_IRQ_CLEAR_REG = 1;
|
||||
|
||||
tusb_vbus_changed(present);
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM
|
||||
//--------------------------------------------------------------------+
|
||||
void UnhandledIRQ(void) {
|
||||
CRG_TOP->SYS_CTRL_REG = 0x80;
|
||||
__BKPT(1);
|
||||
while (1);
|
||||
}
|
||||
|
||||
void board_init(void) {
|
||||
// LED
|
||||
hal_gpio_init_out(LED_PIN, LED_STATE_ON);
|
||||
|
||||
hal_gpio_init_out(1, 0);
|
||||
hal_gpio_init_out(2, 0);
|
||||
hal_gpio_init_out(3, 0);
|
||||
hal_gpio_init_out(4, 0);
|
||||
hal_gpio_init_out(5, 0);
|
||||
|
||||
// Button
|
||||
hal_gpio_init_in(BUTTON_PIN, BUTTON_STATE_ACTIVE ? HAL_GPIO_PULL_DOWN : HAL_GPIO_PULL_UP);
|
||||
|
||||
// 1ms tick timer
|
||||
SysTick_Config(SystemCoreClock / 1000);
|
||||
|
||||
#if CFG_TUD_ENABLED
|
||||
#ifdef NEED_VBUS_MONITOR
|
||||
// Setup interrupt for both connect and disconnect
|
||||
CRG_TOP->VBUS_IRQ_MASK_REG = CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_FALL_Msk |
|
||||
CRG_TOP_VBUS_IRQ_MASK_REG_VBUS_IRQ_EN_RISE_Msk;
|
||||
NVIC_SetPriority(VBUS_IRQn, 2);
|
||||
// Trigger interrupt at the start to inform driver about VBUS state at start
|
||||
// otherwise it could go unnoticed.
|
||||
NVIC_SetPendingIRQ(VBUS_IRQn);
|
||||
NVIC_EnableIRQ(VBUS_IRQn);
|
||||
#else
|
||||
// This board is USB powered there is no need to monitor VBUS line. Notify driver that VBUS is present.
|
||||
tusb_vbus_changed(true);
|
||||
#endif
|
||||
|
||||
/* Setup USB IRQ */
|
||||
NVIC_SetPriority(USB_IRQn, 2);
|
||||
NVIC_EnableIRQ(USB_IRQn);
|
||||
|
||||
/* Use PLL96 / 2 clock not HCLK */
|
||||
CRG_TOP->CLK_CTRL_REG &= ~CRG_TOP_CLK_CTRL_REG_USB_CLK_SRC_Msk;
|
||||
|
||||
mcu_gpio_set_pin_function(14, MCU_GPIO_MODE_INPUT, MCU_GPIO_FUNC_USB);
|
||||
mcu_gpio_set_pin_function(15, MCU_GPIO_MODE_INPUT, MCU_GPIO_FUNC_USB);
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_led_write(bool state) {
|
||||
hal_gpio_write(LED_PIN, state ? LED_STATE_ON : LED_STATE_OFF);
|
||||
}
|
||||
|
||||
uint32_t board_button_read(void) {
|
||||
return BUTTON_STATE_ACTIVE == hal_gpio_read(BUTTON_PIN);
|
||||
}
|
||||
|
||||
int board_uart_read(uint8_t* buf, int len) {
|
||||
(void) buf;
|
||||
(void) len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_uart_write(void const* buf, int len) {
|
||||
(void) buf;
|
||||
(void) len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
volatile uint32_t system_ticks = 0;
|
||||
|
||||
void SysTick_Handler(void) {
|
||||
system_ticks++;
|
||||
}
|
||||
|
||||
uint32_t board_millis(void) {
|
||||
return system_ticks;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
include_guard()
|
||||
|
||||
set(MCU_DIR ${TOP}/hw/mcu/dialog/da1469x)
|
||||
|
||||
# include board specific
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||
|
||||
set(CMAKE_SYSTEM_CPU cortex-m33-nodsp CACHE INTERNAL "System Processor")
|
||||
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
|
||||
set(FAMILY_MCUS DA1469X CACHE INTERNAL "")
|
||||
|
||||
#------------------------------------
|
||||
# BOARD_TARGET
|
||||
#------------------------------------
|
||||
# only need to be built ONCE for all examples
|
||||
function(add_board_target BOARD_TARGET)
|
||||
if (TARGET ${BOARD_TARGET})
|
||||
return()
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED LD_FILE_GNU)
|
||||
set(LD_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/linker/da1469x.ld)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED STARTUP_FILE_${CMAKE_C_COMPILER_ID})
|
||||
set(STARTUP_FILE_GNU ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/gcc_startup_da1469x.S)
|
||||
set(STARTUP_FILE_Clang ${STARTUP_FILE_GNU})
|
||||
endif ()
|
||||
|
||||
add_library(${BOARD_TARGET} STATIC
|
||||
${MCU_DIR}/src/system_da1469x.c
|
||||
${MCU_DIR}/src/da1469x_clock.c
|
||||
${MCU_DIR}/src/hal_gpio.c
|
||||
${STARTUP_FILE_${CMAKE_C_COMPILER_ID}}
|
||||
)
|
||||
target_compile_options(${BOARD_TARGET} PUBLIC -mthumb-interwork)
|
||||
target_compile_definitions(${BOARD_TARGET} PUBLIC
|
||||
CORE_M33
|
||||
CFG_TUD_ENDPOINT0_SIZE=8
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
|
||||
${MCU_DIR}/include
|
||||
${MCU_DIR}/SDK_10.0.8.105/sdk/bsp/include
|
||||
)
|
||||
|
||||
update_board(${BOARD_TARGET})
|
||||
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${NRFX_DIR}/mdk
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
-nostartfiles
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--script=${LD_FILE_GNU}"
|
||||
-L${NRFX_DIR}/mdk
|
||||
)
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "IAR")
|
||||
target_link_options(${BOARD_TARGET} PUBLIC
|
||||
"LINKER:--config=${LD_FILE_IAR}"
|
||||
)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
|
||||
#------------------------------------
|
||||
# Functions
|
||||
#------------------------------------
|
||||
|
||||
function(family_flash_jlink_dialog TARGET)
|
||||
set(JLINKEXE JLinkExe)
|
||||
set(JLINK_IF swd)
|
||||
|
||||
# mkimage from sdk
|
||||
set(MKIMAGE $ENV{HOME}/code/tinyusb-mcu-driver/dialog/SDK_10.0.8.105/binaries/mkimage)
|
||||
|
||||
file(GENERATE OUTPUT $<TARGET_FILE_DIR:${TARGET}>/version.h
|
||||
CONTENT "#define SW_VERSION \"v_1.0.0.1\"
|
||||
#define SW_VERSION_DATE \"2024-07-17 17:55\""
|
||||
)
|
||||
|
||||
file(GENERATE OUTPUT $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.jlink
|
||||
CONTENT "r
|
||||
halt
|
||||
loadfile $<TARGET_FILE_DIR:${TARGET}>/${TARGET}-image.bin 0x16000000
|
||||
r
|
||||
go
|
||||
exit"
|
||||
)
|
||||
|
||||
add_custom_target(${TARGET}-image
|
||||
DEPENDS ${TARGET}
|
||||
COMMAND ${MKIMAGE} da1469x $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin $<TARGET_FILE_DIR:${TARGET}>/version.h $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin.img
|
||||
COMMAND cp ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/product_header.dump $<TARGET_FILE_DIR:${TARGET}>/${TARGET}-image.bin
|
||||
COMMAND cat $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin.img >> $<TARGET_FILE_DIR:${TARGET}>/${TARGET}-image.bin
|
||||
)
|
||||
add_custom_target(${TARGET}-jlink
|
||||
DEPENDS ${TARGET}-image
|
||||
COMMAND ${JLINKEXE} -device ${JLINK_DEVICE} -if ${JLINK_IF} -JTAGConf -1,-1 -speed auto -CommandFile $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.jlink
|
||||
)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(family_configure_example TARGET RTOS)
|
||||
family_configure_common(${TARGET} ${RTOS})
|
||||
|
||||
# Board target
|
||||
add_board_target(board_${BOARD})
|
||||
|
||||
#---------- Port Specific ----------
|
||||
# These files are built for each example since it depends on example's tusb_config.h
|
||||
target_sources(${TARGET} PUBLIC
|
||||
# BSP
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/family.c
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../board.c
|
||||
)
|
||||
target_include_directories(${TARGET} PUBLIC
|
||||
# family, hw, board
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/boards/${BOARD}
|
||||
)
|
||||
|
||||
# Add TinyUSB target and port source
|
||||
family_add_tinyusb(${TARGET} OPT_MCU_DA1469X)
|
||||
target_sources(${TARGET} PUBLIC
|
||||
${TOP}/src/portable/dialog/da146xx/dcd_da146xx.c
|
||||
)
|
||||
target_link_libraries(${TARGET} PUBLIC board_${BOARD})
|
||||
|
||||
|
||||
|
||||
# Flashing
|
||||
family_add_bin_hex(${TARGET})
|
||||
family_flash_jlink_dialog(${TARGET})
|
||||
endfunction()
|
||||
@@ -0,0 +1,62 @@
|
||||
MCU_DIR = hw/mcu/dialog/da1469x
|
||||
|
||||
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||
|
||||
CFLAGS += \
|
||||
-flto \
|
||||
-mthumb \
|
||||
-mthumb-interwork \
|
||||
-mabi=aapcs \
|
||||
-mcpu=cortex-m33+nodsp \
|
||||
-mfloat-abi=hard \
|
||||
-mfpu=fpv5-sp-d16 \
|
||||
-DCORE_M33 \
|
||||
-DCFG_TUSB_MCU=OPT_MCU_DA1469X \
|
||||
-DCFG_TUD_ENDPOINT0_SIZE=8\
|
||||
|
||||
LDFLAGS_GCC += \
|
||||
-nostdlib \
|
||||
--specs=nosys.specs --specs=nano.specs
|
||||
|
||||
# All source paths should be relative to the top level.
|
||||
LD_FILE = $(FAMILY_PATH)/linker/da1469x.ld
|
||||
|
||||
# While this is for da1469x chip, there is chance that da1468x chip family will also work
|
||||
SRC_C += \
|
||||
src/portable/dialog/da146xx/dcd_da146xx.c \
|
||||
${MCU_DIR}/src/system_da1469x.c \
|
||||
${MCU_DIR}/src/da1469x_clock.c \
|
||||
${MCU_DIR}/src/hal_gpio.c \
|
||||
|
||||
SRC_S += $(FAMILY_PATH)/gcc_startup_da1469x.S
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/${MCU_DIR}/include \
|
||||
$(TOP)/${MCU_DIR}/SDK_10.0.8.105/sdk/bsp/include
|
||||
|
||||
# For freeRTOS port source
|
||||
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM33_NTZ/non_secure
|
||||
|
||||
# flash using jlink but with some twists
|
||||
flash: flash-dialog
|
||||
|
||||
# SDK_BINARY_PATH is the path to the SDK binary files
|
||||
SDK_BINARY_PATH = $(HOME)/code/tinyusb-mcu-driver/dialog/SDK_10.0.8.105/binaries
|
||||
MKIMAGE = $(SDK_BINARY_PATH)/mkimage
|
||||
|
||||
$(BUILD)/$(PROJECT)-image.bin: $(BUILD)/$(PROJECT).bin
|
||||
@echo '#define SW_VERSION "v_1.0.0.1"' >$(BUILD)/version.h
|
||||
@echo '#define SW_VERSION_DATE "'`date +"%Y-%m-%d %H:%M"`'"' >> $(BUILD)/version.h
|
||||
$(MKIMAGE) da1469x $^ $(BUILD)/version.h $^.img
|
||||
cp $(TOP)/$(FAMILY_PATH)/product_header.dump $(BUILD)/$(PROJECT)-image.bin
|
||||
cat $^.img >> $(BUILD)/$(PROJECT)-image.bin
|
||||
|
||||
flash-dialog: $(BUILD)/$(PROJECT)-image.bin
|
||||
@echo r > $(BUILD)/$(BOARD).jlink
|
||||
@echo halt >> $(BUILD)/$(BOARD).jlink
|
||||
@echo loadfile $^ 0x16000000 >> $(BUILD)/$(BOARD).jlink
|
||||
@echo r >> $(BUILD)/$(BOARD).jlink
|
||||
@echo go >> $(BUILD)/$(BOARD).jlink
|
||||
@echo exit >> $(BUILD)/$(BOARD).jlink
|
||||
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
|
||||
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
#include "syscfg/syscfg.h"
|
||||
|
||||
.syntax unified
|
||||
.arch armv7-m
|
||||
|
||||
.section .stack
|
||||
.align 3
|
||||
#ifdef __STACK_SIZE
|
||||
.equ Stack_Size, __STACK_SIZE
|
||||
#else
|
||||
.equ Stack_Size, 0xC00
|
||||
#endif
|
||||
.equ SYS_CTRL_REG, 0x50000024
|
||||
.equ CACHE_FLASH_REG, 0x100C0040
|
||||
.equ RESET_STAT_REG, 0x500000BC
|
||||
|
||||
.globl __StackTop
|
||||
.globl __StackLimit
|
||||
__StackLimit:
|
||||
.space Stack_Size
|
||||
.size __StackLimit, . - __StackLimit
|
||||
__StackTop:
|
||||
.size __StackTop, . - __StackTop
|
||||
|
||||
.section .heap
|
||||
.align 3
|
||||
#ifdef __HEAP_SIZE
|
||||
.equ Heap_Size, __HEAP_SIZE
|
||||
#else
|
||||
.equ Heap_Size, 0
|
||||
#endif
|
||||
.globl __HeapBase
|
||||
.globl __HeapLimit
|
||||
__HeapBase:
|
||||
.if Heap_Size
|
||||
.space Heap_Size
|
||||
.endif
|
||||
.size __HeapBase, . - __HeapBase
|
||||
__HeapLimit:
|
||||
.size __HeapLimit, . - __HeapLimit
|
||||
|
||||
.section .isr_vector
|
||||
.align 2
|
||||
.globl __isr_vector
|
||||
__isr_vector:
|
||||
.long __StackTop
|
||||
.long Reset_Handler
|
||||
/* Cortex-M33 interrupts */
|
||||
.long NMI_Handler
|
||||
.long HardFault_Handler
|
||||
.long MemoryManagement_Handler
|
||||
.long BusFault_Handler
|
||||
.long UsageFault_Handler
|
||||
.long SecureFault_Handler
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long SVC_Handler
|
||||
.long DebugMonitor_Handler
|
||||
.long 0 /* Reserved */
|
||||
.long PendSV_Handler
|
||||
.long SysTick_Handler
|
||||
/* DA1469x interrupts */
|
||||
.long SENSOR_NODE_IRQHandler
|
||||
.long DMA_IRQHandler
|
||||
.long CHARGER_STATE_IRQHandler
|
||||
.long CHARGER_ERROR_IRQHandler
|
||||
.long CMAC2SYS_IRQHandler
|
||||
.long UART_IRQHandler
|
||||
.long UART2_IRQHandler
|
||||
.long UART3_IRQHandler
|
||||
.long I2C_IRQHandler
|
||||
.long I2C2_IRQHandler
|
||||
.long SPI_IRQHandler
|
||||
.long SPI2_IRQHandler
|
||||
.long PCM_IRQHandler
|
||||
.long SRC_IN_IRQHandler
|
||||
.long SRC_OUT_IRQHandler
|
||||
.long USB_IRQHandler
|
||||
.long TIMER_IRQHandler
|
||||
.long TIMER2_IRQHandler
|
||||
.long RTC_IRQHandler
|
||||
.long KEY_WKUP_GPIO_IRQHandler
|
||||
.long PDC_IRQHandler
|
||||
.long VBUS_IRQHandler
|
||||
.long MRM_IRQHandler
|
||||
.long MOTOR_CONTROLLER_IRQHandler
|
||||
.long TRNG_IRQHandler
|
||||
.long DCDC_IRQHandler
|
||||
.long XTAL32M_RDY_IRQHandler
|
||||
.long ADC_IRQHandler
|
||||
.long ADC2_IRQHandler
|
||||
.long CRYPTO_IRQHandler
|
||||
.long CAPTIMER1_IRQHandler
|
||||
.long RFDIAG_IRQHandler
|
||||
.long LCD_CONTROLLER_IRQHandler
|
||||
.long PLL_LOCK_IRQHandler
|
||||
.long TIMER3_IRQHandler
|
||||
.long TIMER4_IRQHandler
|
||||
.long LRA_IRQHandler
|
||||
.long RTC_EVENT_IRQHandler
|
||||
.long GPIO_P0_IRQHandler
|
||||
.long GPIO_P1_IRQHandler
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.long 0 /* Reserved */
|
||||
.size __isr_vector, . - __isr_vector
|
||||
|
||||
.text
|
||||
.thumb
|
||||
.thumb_func
|
||||
.align 2
|
||||
.globl Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
/* Make sure interrupt vector is remapped at 0x0 */
|
||||
ldr r1, =SYS_CTRL_REG
|
||||
ldrh r2, [r1, #0]
|
||||
orrs r2, r2, #8
|
||||
strh r2, [r1, #0]
|
||||
|
||||
#if !MYNEWT_VAL(RAM_RESIDENT)
|
||||
/*
|
||||
* Flash is remapped at 0x0 with an offset, i.e. 0x0 does not correspond to
|
||||
* 0x16000000 but to start of an image on flash. This is calculated from product
|
||||
* header by 1st state bootloader and configured in CACHE_FLASH_REG. We need to
|
||||
* retrieve proper offset value for calculations later.
|
||||
*/
|
||||
ldr r1, =CACHE_FLASH_REG
|
||||
ldr r4, [r1, #0]
|
||||
mov r2, r4
|
||||
mov r3, #0xFFFF
|
||||
bic r4, r4, r3 /* CACHE_FLASH_REG[FLASH_REGION_BASE] */
|
||||
mov r3, #0xFFF0
|
||||
and r2, r2, r3 /* CACHE_FLASH_REG[FLASH_REGION_OFFSET] */
|
||||
lsr r2, r2, #2
|
||||
orr r4, r4, r2
|
||||
|
||||
/* Copy ISR vector from flash to RAM */
|
||||
ldr r1, =__isr_vector_start /* src ptr */
|
||||
ldr r2, =__isr_vector_end /* src end */
|
||||
ldr r3, =__intvect_start__ /* dst ptr */
|
||||
/* Make sure we copy from QSPIC address range, not from remapped range */
|
||||
cmp r1, r4
|
||||
itt lt
|
||||
addlt r1, r1, r4
|
||||
addlt r2, r2, r4
|
||||
.loop_isr_copy:
|
||||
cmp r1, r2
|
||||
ittt lt
|
||||
ldrlt r0, [r1], #4
|
||||
strlt r0, [r3], #4
|
||||
blt .loop_isr_copy
|
||||
|
||||
/* Copy QSPI code from flash to RAM */
|
||||
ldr r1, =__text_ram_addr /* src ptr */
|
||||
ldr r2, =__text_ram_start__ /* ptr */
|
||||
ldr r3, =__text_ram_end__ /* dst end */
|
||||
.loop_code_text_ram_copy:
|
||||
cmp r2, r3
|
||||
ittt lt
|
||||
ldrlt r0, [r1], #4
|
||||
strlt r0, [r2], #4
|
||||
blt .loop_code_text_ram_copy
|
||||
|
||||
/* Copy data from flash to RAM */
|
||||
ldr r1, =__etext /* src ptr */
|
||||
ldr r2, =__data_start__ /* dst ptr */
|
||||
ldr r3, =__data_end__ /* dst end */
|
||||
.loop_data_copy:
|
||||
cmp r2, r3
|
||||
ittt lt
|
||||
ldrlt r0, [r1], #4
|
||||
strlt r0, [r2], #4
|
||||
blt .loop_data_copy
|
||||
#endif
|
||||
|
||||
/* Clear BSS */
|
||||
movs r0, 0
|
||||
ldr r1, =__bss_start__
|
||||
ldr r2, =__bss_end__
|
||||
.loop_bss_clear:
|
||||
cmp r1, r2
|
||||
itt lt
|
||||
strlt r0, [r1], #4
|
||||
blt .loop_bss_clear
|
||||
|
||||
ldr r0, =__HeapBase
|
||||
ldr r1, =__HeapLimit
|
||||
/* Call static constructors */
|
||||
bl __libc_init_array
|
||||
|
||||
bl SystemInit
|
||||
bl main
|
||||
|
||||
.pool
|
||||
.size Reset_Handler, . - Reset_Handler
|
||||
|
||||
/* Default interrupt handler */
|
||||
.type Default_Handler, %function
|
||||
Default_Handler:
|
||||
ldr r1, =SYS_CTRL_REG
|
||||
ldrh r2, [r1, #0]
|
||||
orrs r2, r2, #0x80 /* DEBUGGER_ENABLE */
|
||||
strh r2, [r1, #0]
|
||||
b .
|
||||
|
||||
.size Default_Handler, . - Default_Handler
|
||||
|
||||
/* Default handlers for all interrupts */
|
||||
.macro IRQ handler
|
||||
.weak \handler
|
||||
.set \handler, Default_Handler
|
||||
.endm
|
||||
|
||||
/* Cortex-M33 interrupts */
|
||||
IRQ NMI_Handler
|
||||
IRQ HardFault_Handler
|
||||
IRQ MemoryManagement_Handler
|
||||
IRQ BusFault_Handler
|
||||
IRQ UsageFault_Handler
|
||||
IRQ SecureFault_Handler
|
||||
IRQ SVC_Handler
|
||||
IRQ DebugMonitor_Handler
|
||||
IRQ PendSV_Handler
|
||||
IRQ SysTick_Handler
|
||||
/* DA1469x interrupts */
|
||||
IRQ SENSOR_NODE_IRQHandler
|
||||
IRQ DMA_IRQHandler
|
||||
IRQ CHARGER_STATE_IRQHandler
|
||||
IRQ CHARGER_ERROR_IRQHandler
|
||||
IRQ CMAC2SYS_IRQHandler
|
||||
IRQ UART_IRQHandler
|
||||
IRQ UART2_IRQHandler
|
||||
IRQ UART3_IRQHandler
|
||||
IRQ I2C_IRQHandler
|
||||
IRQ I2C2_IRQHandler
|
||||
IRQ SPI_IRQHandler
|
||||
IRQ SPI2_IRQHandler
|
||||
IRQ PCM_IRQHandler
|
||||
IRQ SRC_IN_IRQHandler
|
||||
IRQ SRC_OUT_IRQHandler
|
||||
IRQ USB_IRQHandler
|
||||
IRQ TIMER_IRQHandler
|
||||
IRQ TIMER2_IRQHandler
|
||||
IRQ RTC_IRQHandler
|
||||
IRQ KEY_WKUP_GPIO_IRQHandler
|
||||
IRQ PDC_IRQHandler
|
||||
IRQ VBUS_IRQHandler
|
||||
IRQ MRM_IRQHandler
|
||||
IRQ MOTOR_CONTROLLER_IRQHandler
|
||||
IRQ TRNG_IRQHandler
|
||||
IRQ DCDC_IRQHandler
|
||||
IRQ XTAL32M_RDY_IRQHandler
|
||||
IRQ ADC_IRQHandler
|
||||
IRQ ADC2_IRQHandler
|
||||
IRQ CRYPTO_IRQHandler
|
||||
IRQ CAPTIMER1_IRQHandler
|
||||
IRQ RFDIAG_IRQHandler
|
||||
IRQ LCD_CONTROLLER_IRQHandler
|
||||
IRQ PLL_LOCK_IRQHandler
|
||||
IRQ TIMER3_IRQHandler
|
||||
IRQ TIMER4_IRQHandler
|
||||
IRQ LRA_IRQHandler
|
||||
IRQ RTC_EVENT_IRQHandler
|
||||
IRQ GPIO_P0_IRQHandler
|
||||
IRQ GPIO_P1_IRQHandler
|
||||
IRQ RESERVED40_IRQHandler
|
||||
IRQ RESERVED41_IRQHandler
|
||||
IRQ RESERVED42_IRQHandler
|
||||
IRQ RESERVED43_IRQHandler
|
||||
IRQ RESERVED44_IRQHandler
|
||||
IRQ RESERVED45_IRQHandler
|
||||
IRQ RESERVED46_IRQHandler
|
||||
IRQ RESERVED47_IRQHandler
|
||||
|
||||
.end
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/*
|
||||
* Flash is remapped at 0x0 by 1st stage bootloader, but this is done with
|
||||
* an offset derived from image header thus it is safer to use remapped
|
||||
* address space at 0x0 instead of QSPI_M address space at 0x16000000.
|
||||
* Bootloader partition is 32K, but 9K is currently reserved for product
|
||||
* header (8K) and image header (1K).
|
||||
* First 512 bytes of SYSRAM are remapped at 0x0 and used as ISR vector
|
||||
* (there's no need to reallocate ISR vector) and thus cannot be used by
|
||||
* application.
|
||||
*/
|
||||
|
||||
FLASH (r) : ORIGIN = (0x00000000), LENGTH = (1024 * 1024)
|
||||
RAM (rw) : ORIGIN = (0x20000000), LENGTH = (512 * 1024)
|
||||
}
|
||||
|
||||
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __HeapBase
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
* __bssnz_start__
|
||||
* __bssnz_end__
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
__text = .;
|
||||
|
||||
.text :
|
||||
{
|
||||
__isr_vector_start = .;
|
||||
KEEP(*(.isr_vector))
|
||||
/* ISR vector shall have exactly 512 bytes */
|
||||
. = __isr_vector_start + 0x200;
|
||||
__isr_vector_end = .;
|
||||
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
||||
*(.libcmac.rom)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
*(.eh_frame*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
. = ALIGN(4);
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
.intvect :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__intvect_start__ = .;
|
||||
. = . + (__isr_vector_end - __isr_vector_start);
|
||||
. = ALIGN(4);
|
||||
} > RAM
|
||||
|
||||
.sleep_state (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(sleep_state)
|
||||
} > RAM
|
||||
|
||||
/* This section will be zeroed by RTT package init */
|
||||
.rtt (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rtt)
|
||||
. = ALIGN(4);
|
||||
} > RAM
|
||||
|
||||
__text_ram_addr = LOADADDR(.text_ram);
|
||||
|
||||
.text_ram :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__text_ram_start__ = .;
|
||||
*(.text_ram*)
|
||||
. = ALIGN(4);
|
||||
__text_ram_end__ = .;
|
||||
} > RAM AT > FLASH
|
||||
|
||||
__etext = LOADADDR(.data);
|
||||
|
||||
.data :
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
*(.preinit_array)
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
*(SORT(.init_array.*))
|
||||
*(.init_array)
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
*(SORT(.fini_array.*))
|
||||
*(.fini_array)
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
*(.jcr)
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
} > RAM AT > FLASH
|
||||
|
||||
.bssnz :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bssnz_start__ = .;
|
||||
*(.bss.core.nz*)
|
||||
. = ALIGN(4);
|
||||
__bssnz_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.cmac (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(0x400);
|
||||
*(.libcmac.ram)
|
||||
} > RAM
|
||||
|
||||
/* Heap starts after BSS */
|
||||
. = ALIGN(8);
|
||||
__HeapBase = .;
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
_ram_start = ORIGIN(RAM);
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
/* Top of head is the bottom of the stack */
|
||||
__HeapLimit = __StackLimit;
|
||||
end = __HeapLimit;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__HeapBase <= __HeapLimit, "region RAM overflowed with stack")
|
||||
|
||||
/* Check that intvect is at the beginning of RAM */
|
||||
ASSERT(__intvect_start__ == ORIGIN(RAM), "intvect is not at beginning of RAM")
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user