Initial project setup
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
set(MCU_VARIANT LPC4357)
|
||||
|
||||
set(JLINK_DEVICE LPC4357_M4)
|
||||
set(PYOCD_TARGET LPC4357)
|
||||
set(NXPLINK_DEVICE LPC4357:LPC4357)
|
||||
|
||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/lpc4357.ld)
|
||||
|
||||
function(update_board TARGET)
|
||||
# EA4357 use I2C GPIO expander for LED
|
||||
target_sources(${TARGET} PRIVATE
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/pca9532.c
|
||||
${SDK_DIR}/src/i2c_18xx_43xx.c
|
||||
${SDK_DIR}/src/i2cm_18xx_43xx.c
|
||||
)
|
||||
endfunction()
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 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.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: Embedded Artists LPC4357 Development Kit
|
||||
url: https://www.embeddedartists.com/products/lpc4357-developers-kit/
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_EA4357_H
|
||||
#define _BOARD_EA4357_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "pca9532.h"
|
||||
|
||||
// P9_1 joystick down
|
||||
#define BUTTON_PORT 4
|
||||
#define BUTTON_PIN 13
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
#define UART_DEV LPC_USART0
|
||||
#define UART_PORT 0x0f
|
||||
#define UART_PIN_TX 10
|
||||
#define UART_PIN_RX 11
|
||||
|
||||
//static const struct {
|
||||
// uint8_t mux_port;
|
||||
// uint8_t mux_pin;
|
||||
//
|
||||
// uint8_t gpio_port;
|
||||
// uint8_t gpio_pin;
|
||||
//}buttons[] =
|
||||
//{
|
||||
// {0x0a, 3, 4, 10 }, // Joystick up
|
||||
// {0x09, 1, 4, 13 }, // Joystick down
|
||||
// {0x0a, 2, 4, 9 }, // Joystick left
|
||||
// {0x09, 0, 4, 12 }, // Joystick right
|
||||
// {0x0a, 1, 4, 8 }, // Joystick press
|
||||
// {0x02, 7, 0, 7 }, // SW6
|
||||
//};
|
||||
|
||||
static const PINMUX_GRP_T pinmuxing[] = {
|
||||
// Button ( Joystick down )
|
||||
{ 0x9, 1, SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLUP },
|
||||
|
||||
// UART
|
||||
{ UART_PORT, UART_PIN_TX, SCU_MODE_PULLDOWN | SCU_MODE_FUNC1 },
|
||||
{ UART_PORT, UART_PIN_RX, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1 },
|
||||
|
||||
// USB
|
||||
};
|
||||
|
||||
/* Pin clock mux values, re-used structure, value in first index is meaningless */
|
||||
//static const PINMUX_GRP_T pinclockmuxing[] = {
|
||||
// { 0, 0, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
|
||||
// { 0, 1, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
|
||||
// { 0, 2, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
|
||||
// { 0, 3, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0 },
|
||||
//};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
# EA4357 use I2C GPIO expander for LED
|
||||
SRC_C += \
|
||||
${BOARD_PATH}/pca9532.c \
|
||||
${SDK_DIR}/src/i2c_18xx_43xx.c \
|
||||
${SDK_DIR}/src/i2cm_18xx_43xx.c \
|
||||
|
||||
LD_FILE = ${BOARD_PATH}/lpc4357.ld
|
||||
|
||||
JLINK_DEVICE = LPC4357_M4
|
||||
|
||||
flash: flash-jlink
|
||||
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* GENERATED FILE - DO NOT EDIT
|
||||
* (c) Code Red Technologies Ltd, 2008-2013
|
||||
* (c) NXP Semiconductors 2013-2019
|
||||
* Generated linker script file for LPC4357
|
||||
* Created from linkscript.ldt by FMCreateLinkLibraries
|
||||
* Using Freemarker v2.3.23
|
||||
* MCUXpresso IDE v10.2.1 [Build 795] [2018-07-25] on May 15, 2019 5:48:43 PM
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* Define each memory region */
|
||||
MFlashA512 (rx) : ORIGIN = 0x1a000000, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
|
||||
MFlashB512 (rx) : ORIGIN = 0x1b000000, LENGTH = 0x80000 /* 512K bytes (alias Flash2) */
|
||||
RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
|
||||
RamLoc40 (rwx) : ORIGIN = 0x10080000, LENGTH = 0xa000 /* 40K bytes (alias RAM2) */
|
||||
RamAHB32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM3) */
|
||||
RamAHB16 (rwx) : ORIGIN = 0x20008000, LENGTH = 0x4000 /* 16K bytes (alias RAM4) */
|
||||
RamAHB_ETB16 (rwx) : ORIGIN = 0x2000c000, LENGTH = 0x4000 /* 16K bytes (alias RAM5) */
|
||||
}
|
||||
|
||||
/* Define a symbol for the top of each memory region */
|
||||
__base_MFlashA512 = 0x1a000000 ; /* MFlashA512 */
|
||||
__base_Flash = 0x1a000000 ; /* Flash */
|
||||
__top_MFlashA512 = 0x1a000000 + 0x80000 ; /* 512K bytes */
|
||||
__top_Flash = 0x1a000000 + 0x80000 ; /* 512K bytes */
|
||||
__base_MFlashB512 = 0x1b000000 ; /* MFlashB512 */
|
||||
__base_Flash2 = 0x1b000000 ; /* Flash2 */
|
||||
__top_MFlashB512 = 0x1b000000 + 0x80000 ; /* 512K bytes */
|
||||
__top_Flash2 = 0x1b000000 + 0x80000 ; /* 512K bytes */
|
||||
__base_RamLoc32 = 0x10000000 ; /* RamLoc32 */
|
||||
__base_RAM = 0x10000000 ; /* RAM */
|
||||
__top_RamLoc32 = 0x10000000 + 0x8000 ; /* 32K bytes */
|
||||
__top_RAM = 0x10000000 + 0x8000 ; /* 32K bytes */
|
||||
__base_RamLoc40 = 0x10080000 ; /* RamLoc40 */
|
||||
__base_RAM2 = 0x10080000 ; /* RAM2 */
|
||||
__top_RamLoc40 = 0x10080000 + 0xa000 ; /* 40K bytes */
|
||||
__top_RAM2 = 0x10080000 + 0xa000 ; /* 40K bytes */
|
||||
__base_RamAHB32 = 0x20000000 ; /* RamAHB32 */
|
||||
__base_RAM3 = 0x20000000 ; /* RAM3 */
|
||||
__top_RamAHB32 = 0x20000000 + 0x8000 ; /* 32K bytes */
|
||||
__top_RAM3 = 0x20000000 + 0x8000 ; /* 32K bytes */
|
||||
__base_RamAHB16 = 0x20008000 ; /* RamAHB16 */
|
||||
__base_RAM4 = 0x20008000 ; /* RAM4 */
|
||||
__top_RamAHB16 = 0x20008000 + 0x4000 ; /* 16K bytes */
|
||||
__top_RAM4 = 0x20008000 + 0x4000 ; /* 16K bytes */
|
||||
__base_RamAHB_ETB16 = 0x2000c000 ; /* RamAHB_ETB16 */
|
||||
__base_RAM5 = 0x2000c000 ; /* RAM5 */
|
||||
__top_RamAHB_ETB16 = 0x2000c000 + 0x4000 ; /* 16K bytes */
|
||||
__top_RAM5 = 0x2000c000 + 0x4000 ; /* 16K bytes */
|
||||
|
||||
|
||||
ENTRY(ResetISR)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text_Flash2 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.text_Flash2*) /* for compatibility with previous releases */
|
||||
*(.text_MFlashB512*) /* for compatibility with previous releases */
|
||||
*(.text.$Flash2*)
|
||||
*(.text.$MFlashB512*)
|
||||
*(.rodata.$Flash2*)
|
||||
*(.rodata.$MFlashB512*)
|
||||
} > MFlashB512
|
||||
|
||||
/* MAIN TEXT SECTION */
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
__vectors_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.isr_vector))
|
||||
/* Global Section Table */
|
||||
. = ALIGN(4) ;
|
||||
__section_table_start = .;
|
||||
__data_section_table = .;
|
||||
LONG(LOADADDR(.data));
|
||||
LONG( ADDR(.data));
|
||||
LONG( SIZEOF(.data));
|
||||
LONG(LOADADDR(.data_RAM2));
|
||||
LONG( ADDR(.data_RAM2));
|
||||
LONG( SIZEOF(.data_RAM2));
|
||||
LONG(LOADADDR(.data_RAM3));
|
||||
LONG( ADDR(.data_RAM3));
|
||||
LONG( SIZEOF(.data_RAM3));
|
||||
LONG(LOADADDR(.data_RAM4));
|
||||
LONG( ADDR(.data_RAM4));
|
||||
LONG( SIZEOF(.data_RAM4));
|
||||
LONG(LOADADDR(.data_RAM5));
|
||||
LONG( ADDR(.data_RAM5));
|
||||
LONG( SIZEOF(.data_RAM5));
|
||||
__data_section_table_end = .;
|
||||
__bss_section_table = .;
|
||||
LONG( ADDR(.bss));
|
||||
LONG( SIZEOF(.bss));
|
||||
LONG( ADDR(.bss_RAM2));
|
||||
LONG( SIZEOF(.bss_RAM2));
|
||||
LONG( ADDR(.bss_RAM3));
|
||||
LONG( SIZEOF(.bss_RAM3));
|
||||
LONG( ADDR(.bss_RAM4));
|
||||
LONG( SIZEOF(.bss_RAM4));
|
||||
LONG( ADDR(.bss_RAM5));
|
||||
LONG( SIZEOF(.bss_RAM5));
|
||||
__bss_section_table_end = .;
|
||||
__section_table_end = . ;
|
||||
/* End of Global Section Table */
|
||||
|
||||
*(.after_vectors*)
|
||||
|
||||
} > MFlashA512
|
||||
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
*(.text*)
|
||||
*(.rodata .rodata.* .constdata .constdata.*)
|
||||
. = ALIGN(4);
|
||||
} > MFlashA512
|
||||
/*
|
||||
* for exception handling/unwind - some Newlib functions (in common
|
||||
* with C++ and STDC++) use this.
|
||||
*/
|
||||
.ARM.extab : ALIGN(4)
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > MFlashA512
|
||||
|
||||
__exidx_start = .;
|
||||
|
||||
.ARM.exidx : ALIGN(4)
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > MFlashA512
|
||||
__exidx_end = .;
|
||||
|
||||
_etext = .;
|
||||
|
||||
/* DATA section for RamLoc40 */
|
||||
|
||||
.data_RAM2 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM2 = .) ;
|
||||
*(.ramfunc.$RAM2)
|
||||
*(.ramfunc.$RamLoc40)
|
||||
*(.data.$RAM2*)
|
||||
*(.data.$RamLoc40*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM2 = .) ;
|
||||
} > RamLoc40 AT>MFlashA512
|
||||
/* DATA section for RamAHB32 */
|
||||
|
||||
.data_RAM3 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM3 = .) ;
|
||||
*(.ramfunc.$RAM3)
|
||||
*(.ramfunc.$RamAHB32)
|
||||
*(.data.$RAM3*)
|
||||
*(.data.$RamAHB32*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM3 = .) ;
|
||||
} > RamAHB32 AT>MFlashA512
|
||||
/* DATA section for RamAHB16 */
|
||||
|
||||
.data_RAM4 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM4 = .) ;
|
||||
*(.ramfunc.$RAM4)
|
||||
*(.ramfunc.$RamAHB16)
|
||||
*(.data.$RAM4*)
|
||||
*(.data.$RamAHB16*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM4 = .) ;
|
||||
} > RamAHB16 AT>MFlashA512
|
||||
/* DATA section for RamAHB_ETB16 */
|
||||
|
||||
.data_RAM5 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM5 = .) ;
|
||||
*(.ramfunc.$RAM5)
|
||||
*(.ramfunc.$RamAHB_ETB16)
|
||||
*(.data.$RAM5*)
|
||||
*(.data.$RamAHB_ETB16*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM5 = .) ;
|
||||
} > RamAHB_ETB16 AT>MFlashA512
|
||||
/* MAIN DATA SECTION */
|
||||
.uninit_RESERVED : ALIGN(4)
|
||||
{
|
||||
KEEP(*(.bss.$RESERVED*))
|
||||
. = ALIGN(4) ;
|
||||
_end_uninit_RESERVED = .;
|
||||
} > RamLoc32
|
||||
|
||||
/* Main DATA section (RamLoc32) */
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
_data = . ;
|
||||
*(vtable)
|
||||
*(.ramfunc*)
|
||||
*(.data*)
|
||||
. = ALIGN(4) ;
|
||||
_edata = . ;
|
||||
} > RamLoc32 AT>MFlashA512
|
||||
|
||||
/* BSS section for RamLoc40 */
|
||||
.bss_RAM2 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM2 = .) ;
|
||||
*(.bss.$RAM2*)
|
||||
*(.bss.$RamLoc40*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM2 = .) ;
|
||||
} > RamLoc40
|
||||
|
||||
/* BSS section for RamAHB32 */
|
||||
.bss_RAM3 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM3 = .) ;
|
||||
*(.bss.$RAM3*)
|
||||
*(.bss.$RamAHB32*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM3 = .) ;
|
||||
} > RamAHB32
|
||||
|
||||
/* BSS section for RamAHB16 */
|
||||
.bss_RAM4 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM4 = .) ;
|
||||
*(.bss.$RAM4*)
|
||||
*(.bss.$RamAHB16*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM4 = .) ;
|
||||
} > RamAHB16
|
||||
|
||||
/* BSS section for RamAHB_ETB16 */
|
||||
.bss_RAM5 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM5 = .) ;
|
||||
*(.bss.$RAM5*)
|
||||
*(.bss.$RamAHB_ETB16*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM5 = .) ;
|
||||
} > RamAHB_ETB16
|
||||
|
||||
/* MAIN BSS SECTION: EDIT change to RamLoc40 */
|
||||
.bss : ALIGN(4)
|
||||
{
|
||||
_bss = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4) ;
|
||||
_ebss = .;
|
||||
/* PROVIDE(end = .); */
|
||||
} > RamLoc40 /* RamLoc32 */
|
||||
|
||||
/* NOINIT section for RamLoc40 */
|
||||
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
*(.noinit.$RAM2*)
|
||||
*(.noinit.$RamLoc40*)
|
||||
. = ALIGN(4) ;
|
||||
} > RamLoc40
|
||||
|
||||
/* hathach add heap section for clang */
|
||||
.heap (NOLOAD): {
|
||||
__heap_start = .;
|
||||
__HeapBase = .;
|
||||
__heap_base = .;
|
||||
__end = .;
|
||||
PROVIDE(end = .);
|
||||
PROVIDE(_end = .);
|
||||
PROVIDE(__end__ = .);
|
||||
KEEP(*(.heap*))
|
||||
__HeapLimit = .;
|
||||
__heap_limit = .;
|
||||
__heap_end = .;
|
||||
} > RamLoc40
|
||||
|
||||
/* NOINIT section for RamAHB32 */
|
||||
.noinit_RAM3 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
*(.noinit.$RAM3*)
|
||||
*(.noinit.$RamAHB32*)
|
||||
. = ALIGN(4) ;
|
||||
} > RamAHB32
|
||||
|
||||
/* NOINIT section for RamAHB16 */
|
||||
.noinit_RAM4 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
*(.noinit.$RAM4*)
|
||||
*(.noinit.$RamAHB16*)
|
||||
. = ALIGN(4) ;
|
||||
} > RamAHB16
|
||||
|
||||
/* NOINIT section for RamAHB_ETB16 */
|
||||
.noinit_RAM5 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
*(.noinit.$RAM5*)
|
||||
*(.noinit.$RamAHB_ETB16*)
|
||||
. = ALIGN(4) ;
|
||||
} > RamAHB_ETB16
|
||||
|
||||
/* DEFAULT NOINIT SECTION */
|
||||
.noinit (NOLOAD): ALIGN(4)
|
||||
{
|
||||
_noinit = .;
|
||||
*(.noinit*)
|
||||
. = ALIGN(4) ;
|
||||
_end_noinit = .;
|
||||
} > RamLoc32
|
||||
/* PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);*/
|
||||
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||
|
||||
/* ## Create checksum value (used in startup) ## */
|
||||
/* This cause issue with clang linker, so it is disabled */
|
||||
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||
/* (_vStackTop*/
|
||||
/* + (ResetISR + 1)*/
|
||||
/* + (NMI_Handler + 1)*/
|
||||
/* + (HardFault_Handler + 1)*/
|
||||
/* + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1)*/
|
||||
/* ) );*/
|
||||
|
||||
/* Provide basic symbols giving location and size of main text
|
||||
* block, including initial values of RW data sections. Note that
|
||||
* these will need extending to give a complete picture with
|
||||
* complex images (e.g multiple Flash banks).
|
||||
*/
|
||||
_image_start = LOADADDR(.text);
|
||||
_image_end = LOADADDR(.data) + SIZEOF(.data);
|
||||
_image_size = _image_end - _image_start;
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright(C) 2011, Embedded Artists AB
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* Software that is described herein is for illustrative purposes only
|
||||
* which provides customers with programming information regarding the
|
||||
* products. This software is supplied "AS IS" without any warranties.
|
||||
* Embedded Artists AB assumes no responsibility or liability for the
|
||||
* use of the software, conveys no license or title under any patent,
|
||||
* copyright, or mask work right to the product. Embedded Artists AB
|
||||
* reserves the right to make changes in the software without
|
||||
* notification. Embedded Artists AB also make no representation or
|
||||
* warranty that such application will be suitable for the specified
|
||||
* use without further testing or modification.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* NOTE: I2C must have been initialized before calling any functions in this
|
||||
* file.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Includes
|
||||
*****************************************************************************/
|
||||
|
||||
//#include "board.h"
|
||||
#include "chip.h"
|
||||
|
||||
#include "pca9532.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Defines and typedefs
|
||||
*****************************************************************************/
|
||||
|
||||
#define I2C_PORT (LPC_I2C0)
|
||||
|
||||
#define LS_MODE_ON 0x01
|
||||
#define LS_MODE_BLINK0 0x02
|
||||
#define LS_MODE_BLINK1 0x03
|
||||
|
||||
/******************************************************************************
|
||||
* External global variables
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Local variables
|
||||
*****************************************************************************/
|
||||
|
||||
static uint16_t blink0Shadow = 0;
|
||||
static uint16_t blink1Shadow = 0;
|
||||
static uint16_t ledStateShadow = 0;
|
||||
|
||||
/******************************************************************************
|
||||
* Local Functions
|
||||
*****************************************************************************/
|
||||
|
||||
static Status I2CWrite(uint32_t addr, uint8_t* buf, uint32_t len)
|
||||
{
|
||||
I2CM_XFER_T i2cData;
|
||||
|
||||
i2cData.slaveAddr = addr;
|
||||
i2cData.options = 0;
|
||||
i2cData.status = 0;
|
||||
i2cData.txBuff = buf;
|
||||
i2cData.txSz = len;
|
||||
i2cData.rxBuff = NULL;
|
||||
i2cData.rxSz = 0;
|
||||
|
||||
if (Chip_I2CM_XferBlocking(LPC_I2C0, &i2cData) == 0) {
|
||||
return ERROR;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static Status I2CRead(uint32_t addr, uint8_t* buf, uint32_t len)
|
||||
{
|
||||
I2CM_XFER_T i2cData;
|
||||
|
||||
i2cData.slaveAddr = addr;
|
||||
i2cData.options = 0;
|
||||
i2cData.status = 0;
|
||||
i2cData.txBuff = NULL;
|
||||
i2cData.txSz = 0;
|
||||
i2cData.rxBuff = buf;
|
||||
i2cData.rxSz = len;
|
||||
|
||||
if (Chip_I2CM_XferBlocking(LPC_I2C0, &i2cData) == 0) {
|
||||
return ERROR;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static void setLsStates(uint16_t states, uint8_t* ls, uint8_t mode)
|
||||
{
|
||||
#define IS_LED_SET(bit, x) ( ( ((x) & (bit)) != 0 ) ? 1 : 0 )
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
||||
ls[i] |= ( (IS_LED_SET(0x0001, states)*mode << 0)
|
||||
| (IS_LED_SET(0x0002, states)*mode << 2)
|
||||
| (IS_LED_SET(0x0004, states)*mode << 4)
|
||||
| (IS_LED_SET(0x0008, states)*mode << 6) );
|
||||
|
||||
states >>= 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void setLeds(void)
|
||||
{
|
||||
uint8_t buf[5];
|
||||
uint8_t ls[4] = {0,0,0,0};
|
||||
uint16_t states = ledStateShadow;
|
||||
|
||||
/* LEDs in On/Off state */
|
||||
setLsStates(states, ls, LS_MODE_ON);
|
||||
|
||||
/* set the LEDs that should blink */
|
||||
setLsStates(blink0Shadow, ls, LS_MODE_BLINK0);
|
||||
setLsStates(blink1Shadow, ls, LS_MODE_BLINK1);
|
||||
|
||||
|
||||
buf[0] = PCA9532_LS0 | PCA9532_AUTO_INC;
|
||||
buf[1] = ls[0];
|
||||
buf[2] = ls[1];
|
||||
buf[3] = ls[2];
|
||||
buf[4] = ls[3];
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 5);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Public Functions
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Initialize the PCA9532 Device
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_init (void)
|
||||
{
|
||||
/* nothing to initialize */
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Get the LED states
|
||||
*
|
||||
* Params:
|
||||
* [in] shadow - TRUE if the states should be retrieved from the shadow
|
||||
* variables. The shadow variable are updated when any
|
||||
* of setLeds, setBlink0Leds and/or setBlink1Leds are
|
||||
* called.
|
||||
*
|
||||
* FALSE if the state should be retrieved from the PCA9532
|
||||
* device. A blinkin LED may be reported as on or off
|
||||
* depending on the state when calling the function.
|
||||
*
|
||||
* Returns:
|
||||
* A mask where a 1 indicates that a LED is on (or blinking).
|
||||
*
|
||||
*****************************************************************************/
|
||||
uint16_t pca9532_getLedState (uint32_t shadow)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
uint16_t ret = 0;
|
||||
|
||||
if (shadow) {
|
||||
/* a blink LED is reported as on*/
|
||||
ret = (ledStateShadow | blink0Shadow | blink1Shadow);
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
* A blinking LED may be reported as on or off depending on
|
||||
* its state when reading the Input register.
|
||||
*/
|
||||
|
||||
buf[0] = PCA9532_INPUT0;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 1);
|
||||
|
||||
I2CRead(PCA9532_I2C_ADDR, buf, 1);
|
||||
ret = buf[0];
|
||||
|
||||
|
||||
buf[0] = PCA9532_INPUT1;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 1);
|
||||
|
||||
I2CRead(PCA9532_I2C_ADDR, buf, 1);
|
||||
ret |= (buf[0] << 8);
|
||||
|
||||
|
||||
/* invert since LEDs are active low */
|
||||
ret = ((~ret) & 0xFFFF);
|
||||
}
|
||||
|
||||
return (ret & ~PCA9532_NOT_USED);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set LED states (on or off).
|
||||
*
|
||||
* Params:
|
||||
* [in] ledOnMask - The LEDs that should be turned on. This mask has
|
||||
* priority over ledOffMask
|
||||
* [in] ledOffMask - The LEDs that should be turned off.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setLeds (uint16_t ledOnMask, uint16_t ledOffMask)
|
||||
{
|
||||
/* turn off leds */
|
||||
ledStateShadow &= (~(ledOffMask) & 0xffff);
|
||||
|
||||
/* ledOnMask has priority over ledOffMask */
|
||||
ledStateShadow |= ledOnMask;
|
||||
|
||||
/* turn off blinking */
|
||||
blink0Shadow &= (~(ledOffMask) & 0xffff);
|
||||
blink1Shadow &= (~(ledOffMask) & 0xffff);
|
||||
|
||||
setLeds();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the blink period for PWM0. Valid values are 0 - 255 where 0
|
||||
* means 152 Hz and 255 means 0.59 Hz. A value of 151 means 1 Hz.
|
||||
*
|
||||
* Params:
|
||||
* [in] period - the period for pwm0
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink0Period(uint8_t period)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
buf[0] = PCA9532_PSC0;
|
||||
buf[1] = period;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 2);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the duty cycle for PWM0. Valid values are 0 - 100. 25 means the LED
|
||||
* is on 25% of the period.
|
||||
*
|
||||
* Params:
|
||||
* [in] duty - duty cycle
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink0Duty(uint8_t duty)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
uint32_t tmp = duty;
|
||||
if (tmp > 100) {
|
||||
tmp = 100;
|
||||
}
|
||||
|
||||
tmp = (256 * tmp)/100;
|
||||
|
||||
buf[0] = PCA9532_PWM0;
|
||||
buf[1] = tmp;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 2);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the LEDs that should blink with rate and duty cycle from PWM0.
|
||||
* Blinking is turned off with pca9532_setLeds.
|
||||
*
|
||||
* Params:
|
||||
* [in] ledMask - LEDs that should blink.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink0Leds(uint16_t ledMask)
|
||||
{
|
||||
blink0Shadow |= ledMask;
|
||||
setLeds();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the blink period for PWM1. Valid values are 0 - 255 where 0
|
||||
* means 152 Hz and 255 means 0.59 Hz. A value of 151 means 1 Hz.
|
||||
*
|
||||
* Params:
|
||||
* [in] period - The period for PWM1
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink1Period(uint8_t period)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
buf[0] = PCA9532_PSC1;
|
||||
buf[1] = period;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 2);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the duty cycle for PWM1. Valid values are 0 - 100. 25 means the LED
|
||||
* is on 25% of the period.
|
||||
*
|
||||
* Params:
|
||||
* [in] duty - duty cycle.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink1Duty(uint8_t duty)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
|
||||
uint32_t tmp = duty;
|
||||
if (tmp > 100) {
|
||||
tmp = 100;
|
||||
}
|
||||
|
||||
tmp = (256 * tmp)/100;
|
||||
|
||||
buf[0] = PCA9532_PWM1;
|
||||
buf[1] = tmp;
|
||||
I2CWrite(PCA9532_I2C_ADDR, buf, 2);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Description:
|
||||
* Set the LEDs that should blink with rate and duty cycle from PWM1.
|
||||
* Blinking is turned off with pca9532_setLeds.
|
||||
*
|
||||
* Params:
|
||||
* [in] ledMask - LEDs that should blink.
|
||||
*
|
||||
*****************************************************************************/
|
||||
void pca9532_setBlink1Leds(uint16_t ledMask)
|
||||
{
|
||||
blink1Shadow |= ledMask;
|
||||
setLeds();
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Copyright(C) 2011, Embedded Artists AB
|
||||
* All rights reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* Software that is described herein is for illustrative purposes only
|
||||
* which provides customers with programming information regarding the
|
||||
* products. This software is supplied "AS IS" without any warranties.
|
||||
* Embedded Artists AB assumes no responsibility or liability for the
|
||||
* use of the software, conveys no license or title under any patent,
|
||||
* copyright, or mask work right to the product. Embedded Artists AB
|
||||
* reserves the right to make changes in the software without
|
||||
* notification. Embedded Artists AB also make no representation or
|
||||
* warranty that such application will be suitable for the specified
|
||||
* use without further testing or modification.
|
||||
*****************************************************************************/
|
||||
#ifndef __PCA9532C_H
|
||||
#define __PCA9532C_H
|
||||
|
||||
|
||||
#define PCA9532_I2C_ADDR (0xC0>>1)
|
||||
|
||||
#define PCA9532_INPUT0 0x00
|
||||
#define PCA9532_INPUT1 0x01
|
||||
#define PCA9532_PSC0 0x02
|
||||
#define PCA9532_PWM0 0x03
|
||||
#define PCA9532_PSC1 0x04
|
||||
#define PCA9532_PWM1 0x05
|
||||
#define PCA9532_LS0 0x06
|
||||
#define PCA9532_LS1 0x07
|
||||
#define PCA9532_LS2 0x08
|
||||
#define PCA9532_LS3 0x09
|
||||
|
||||
#define PCA9532_AUTO_INC 0x10
|
||||
|
||||
|
||||
/*
|
||||
* The Keys on the base board are mapped to LED0 -> LED3 on
|
||||
* the PCA9532.
|
||||
*/
|
||||
|
||||
#define KEY1 0x0001
|
||||
#define KEY2 0x0002
|
||||
#define KEY3 0x0004
|
||||
#define KEY4 0x0008
|
||||
|
||||
#define KEY_MASK 0x000F
|
||||
|
||||
/*
|
||||
* MMC Card Detect and MMC Write Protect are mapped to LED4
|
||||
* and LED5 on the PCA9532. Please note that WP is active low.
|
||||
*/
|
||||
|
||||
#define MMC_CD 0x0010
|
||||
#define MMC_WP 0x0020
|
||||
|
||||
#define MMC_MASK 0x30
|
||||
|
||||
/* NOTE: LED6 and LED7 on PCA9532 are not connected to anything */
|
||||
#define PCA9532_NOT_USED 0xC0
|
||||
|
||||
/*
|
||||
* Below are the LED constants to use when enabling/disabling a LED.
|
||||
* The LED names are the names printed on the base board and not
|
||||
* the names from the PCA9532 device. base_LED1 -> LED8 on PCA9532,
|
||||
* base_LED2 -> LED9, and so on.
|
||||
*/
|
||||
|
||||
#define LED1 0x0100
|
||||
#define LED2 0x0200
|
||||
#define LED3 0x0400
|
||||
#define LED4 0x0800
|
||||
#define LED5 0x1000
|
||||
#define LED6 0x2000
|
||||
#define LED7 0x4000
|
||||
#define LED8 0x8000
|
||||
|
||||
#define LED_MASK 0xFF00
|
||||
|
||||
void pca9532_init (void);
|
||||
uint16_t pca9532_getLedState (uint32_t shadow);
|
||||
void pca9532_setLeds (uint16_t ledOnMask, uint16_t ledOffMask);
|
||||
void pca9532_setBlink0Period(uint8_t period);
|
||||
void pca9532_setBlink0Duty(uint8_t duty);
|
||||
void pca9532_setBlink0Leds(uint16_t ledMask);
|
||||
void pca9532_setBlink1Period(uint8_t period);
|
||||
void pca9532_setBlink1Duty(uint8_t duty);
|
||||
void pca9532_setBlink1Leds(uint16_t ledMask);
|
||||
|
||||
#endif /* end __PCA9532C_H */
|
||||
/****************************************************************************
|
||||
** End Of File
|
||||
*****************************************************************************/
|
||||
@@ -0,0 +1,11 @@
|
||||
set(MCU_VARIANT LPC43S67_M4)
|
||||
|
||||
set(JLINK_DEVICE LPC43S67_M4)
|
||||
set(PYOCD_TARGET LPC43S67)
|
||||
set(NXPLINK_DEVICE LPC43S67:LPCXPRESSO43S67)
|
||||
|
||||
set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/lpc4367.ld)
|
||||
|
||||
function(update_board TARGET)
|
||||
# nothing to do
|
||||
endfunction()
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2021, 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.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: LPCXpresso43S67
|
||||
url: https://www.nxp.com/design/design-center/software/development-software/mcuxpresso-software-and-tools-/lpcxpresso-boards/lpcxpresso43s67-development-board:OM13084
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_LPCXPRESSO43S67_H_
|
||||
#define _BOARD_LPCXPRESSO43S67_H_
|
||||
|
||||
// Note: For USB Host demo, install JP4
|
||||
// WARNING: don't install JP4 when running as device
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// LED Red
|
||||
#define LED_PORT 3
|
||||
#define LED_PIN 7
|
||||
#define LED_STATE_ON 0
|
||||
|
||||
// ISP Button (SW2)
|
||||
#define BUTTON_PORT 0
|
||||
#define BUTTON_PIN 7
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
#define UART_DEV LPC_USART0
|
||||
|
||||
static const PINMUX_GRP_T pinmuxing[] = {
|
||||
// LEDs P6_11 as GPIO3[7]
|
||||
{ 0x6, 11, SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC0 },
|
||||
|
||||
// Button P2_7 as GPIO0[7]
|
||||
{ 0x2, 7, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC0 },
|
||||
|
||||
// UART
|
||||
{ 0x06, 4, SCU_MODE_PULLDOWN | SCU_MODE_FUNC2 },
|
||||
{ 0x02, 1, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC1 },
|
||||
|
||||
// USB0
|
||||
//{ 0x6, 3, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC1 }, // P6_3 USB0_PWR_EN, USB0 VBus function
|
||||
|
||||
// USB 1
|
||||
//{ 0x9, 5, SCU_MODE_PULLUP | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC2 }, // P9_5 USB1_VBUS_EN, USB1 VBus function
|
||||
//{ 0x2, 5, SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_FUNC2 }, // P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION
|
||||
{0x2, 5, SCU_MODE_INBUFF_EN | SCU_MODE_PULLUP | SCU_MODE_FUNC4 },
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
LD_FILE = $(BOARD_PATH)/lpc4367.ld
|
||||
|
||||
# For flash-jlink target
|
||||
JLINK_DEVICE = LPC43S67_M4
|
||||
|
||||
flash: flash-jlink
|
||||
@@ -0,0 +1,419 @@
|
||||
/*
|
||||
* GENERATED FILE - DO NOT EDIT
|
||||
* Copyright (c) 2008-2013 Code Red Technologies Ltd,
|
||||
* Copyright 2015, 2018-2019 NXP
|
||||
* (c) NXP Semiconductors 2013-2023
|
||||
* Generated linker script file for LPC4337
|
||||
* Created from linkscript.ldt by FMCreateLinkLibraries
|
||||
* Using Freemarker v2.3.30
|
||||
* MCUXpresso IDE v11.7.1 [Build 9221] [2023-03-28] on Aug 14, 2023, 3:36:29 PM
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* Define each memory region */
|
||||
MFlashA512 (rx) : ORIGIN = 0x1a000000, LENGTH = 0x80000 /* 512K bytes (alias Flash) */
|
||||
MFlashB512 (rx) : ORIGIN = 0x1b000000, LENGTH = 0x80000 /* 512K bytes (alias Flash2) */
|
||||
RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
|
||||
RamLoc40 (rwx) : ORIGIN = 0x10080000, LENGTH = 0xa000 /* 40K bytes (alias RAM2) */
|
||||
RamAHB32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes (alias RAM3) */
|
||||
RamAHB16 (rwx) : ORIGIN = 0x20008000, LENGTH = 0x4000 /* 16K bytes (alias RAM4) */
|
||||
RamAHB_ETB16 (rwx) : ORIGIN = 0x2000c000, LENGTH = 0x4000 /* 16K bytes (alias RAM5) */
|
||||
}
|
||||
|
||||
/* Define a symbol for the top of each memory region */
|
||||
__base_MFlashA512 = 0x1a000000 ; /* MFlashA512 */
|
||||
__base_Flash = 0x1a000000 ; /* Flash */
|
||||
__top_MFlashA512 = 0x1a000000 + 0x80000 ; /* 512K bytes */
|
||||
__top_Flash = 0x1a000000 + 0x80000 ; /* 512K bytes */
|
||||
__base_MFlashB512 = 0x1b000000 ; /* MFlashB512 */
|
||||
__base_Flash2 = 0x1b000000 ; /* Flash2 */
|
||||
__top_MFlashB512 = 0x1b000000 + 0x80000 ; /* 512K bytes */
|
||||
__top_Flash2 = 0x1b000000 + 0x80000 ; /* 512K bytes */
|
||||
__base_RamLoc32 = 0x10000000 ; /* RamLoc32 */
|
||||
__base_RAM = 0x10000000 ; /* RAM */
|
||||
__top_RamLoc32 = 0x10000000 + 0x8000 ; /* 32K bytes */
|
||||
__top_RAM = 0x10000000 + 0x8000 ; /* 32K bytes */
|
||||
__base_RamLoc40 = 0x10080000 ; /* RamLoc40 */
|
||||
__base_RAM2 = 0x10080000 ; /* RAM2 */
|
||||
__top_RamLoc40 = 0x10080000 + 0xa000 ; /* 40K bytes */
|
||||
__top_RAM2 = 0x10080000 + 0xa000 ; /* 40K bytes */
|
||||
__base_RamAHB32 = 0x20000000 ; /* RamAHB32 */
|
||||
__base_RAM3 = 0x20000000 ; /* RAM3 */
|
||||
__top_RamAHB32 = 0x20000000 + 0x8000 ; /* 32K bytes */
|
||||
__top_RAM3 = 0x20000000 + 0x8000 ; /* 32K bytes */
|
||||
__base_RamAHB16 = 0x20008000 ; /* RamAHB16 */
|
||||
__base_RAM4 = 0x20008000 ; /* RAM4 */
|
||||
__top_RamAHB16 = 0x20008000 + 0x4000 ; /* 16K bytes */
|
||||
__top_RAM4 = 0x20008000 + 0x4000 ; /* 16K bytes */
|
||||
__base_RamAHB_ETB16 = 0x2000c000 ; /* RamAHB_ETB16 */
|
||||
__base_RAM5 = 0x2000c000 ; /* RAM5 */
|
||||
__top_RamAHB_ETB16 = 0x2000c000 + 0x4000 ; /* 16K bytes */
|
||||
__top_RAM5 = 0x2000c000 + 0x4000 ; /* 16K bytes */
|
||||
|
||||
ENTRY(ResetISR)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text_Flash2 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
*(.text_Flash2) /* for compatibility with previous releases */
|
||||
*(.text_MFlashB512) /* for compatibility with previous releases */
|
||||
*(.text.$Flash2)
|
||||
*(.text.$MFlashB512)
|
||||
*(.text_Flash2.*) /* for compatibility with previous releases */
|
||||
*(.text_MFlashB512.*) /* for compatibility with previous releases */
|
||||
*(.text.$Flash2.*)
|
||||
*(.text.$MFlashB512.*)
|
||||
*(.rodata.$Flash2)
|
||||
*(.rodata.$MFlashB512)
|
||||
*(.rodata.$Flash2.*)
|
||||
*(.rodata.$MFlashB512.*) } > MFlashB512
|
||||
|
||||
/* MAIN TEXT SECTION */
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
__vectors_start__ = ABSOLUTE(.) ;
|
||||
KEEP(*(.isr_vector))
|
||||
/* Global Section Table */
|
||||
. = ALIGN(4) ;
|
||||
__section_table_start = .;
|
||||
__data_section_table = .;
|
||||
LONG(LOADADDR(.data));
|
||||
LONG( ADDR(.data));
|
||||
LONG( SIZEOF(.data));
|
||||
LONG(LOADADDR(.data_RAM2));
|
||||
LONG( ADDR(.data_RAM2));
|
||||
LONG( SIZEOF(.data_RAM2));
|
||||
LONG(LOADADDR(.data_RAM3));
|
||||
LONG( ADDR(.data_RAM3));
|
||||
LONG( SIZEOF(.data_RAM3));
|
||||
LONG(LOADADDR(.data_RAM4));
|
||||
LONG( ADDR(.data_RAM4));
|
||||
LONG( SIZEOF(.data_RAM4));
|
||||
LONG(LOADADDR(.data_RAM5));
|
||||
LONG( ADDR(.data_RAM5));
|
||||
LONG( SIZEOF(.data_RAM5));
|
||||
__data_section_table_end = .;
|
||||
__bss_section_table = .;
|
||||
LONG( ADDR(.bss));
|
||||
LONG( SIZEOF(.bss));
|
||||
LONG( ADDR(.bss_RAM2));
|
||||
LONG( SIZEOF(.bss_RAM2));
|
||||
LONG( ADDR(.bss_RAM3));
|
||||
LONG( SIZEOF(.bss_RAM3));
|
||||
LONG( ADDR(.bss_RAM4));
|
||||
LONG( SIZEOF(.bss_RAM4));
|
||||
LONG( ADDR(.bss_RAM5));
|
||||
LONG( SIZEOF(.bss_RAM5));
|
||||
__bss_section_table_end = .;
|
||||
__section_table_end = . ;
|
||||
/* End of Global Section Table */
|
||||
|
||||
*(.after_vectors*)
|
||||
|
||||
*(.text*)
|
||||
*(.rodata .rodata.* .constdata .constdata.*)
|
||||
. = ALIGN(4);
|
||||
} > MFlashA512
|
||||
/*
|
||||
* for exception handling/unwind - some Newlib functions (in common
|
||||
* with C++ and STDC++) use this.
|
||||
*/
|
||||
.ARM.extab : ALIGN(4)
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > MFlashA512
|
||||
|
||||
.ARM.exidx : ALIGN(4)
|
||||
{
|
||||
__exidx_start = .;
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
__exidx_end = .;
|
||||
} > MFlashA512
|
||||
|
||||
_etext = .;
|
||||
|
||||
/* DATA section for RamLoc40 */
|
||||
|
||||
.data_RAM2 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM2 = .) ;
|
||||
PROVIDE(__start_data_RamLoc40 = .) ;
|
||||
*(.ramfunc.$RAM2)
|
||||
*(.ramfunc.$RamLoc40)
|
||||
*(.data.$RAM2)
|
||||
*(.data.$RamLoc40)
|
||||
*(.data.$RAM2.*)
|
||||
*(.data.$RamLoc40.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM2 = .) ;
|
||||
PROVIDE(__end_data_RamLoc40 = .) ;
|
||||
} > RamLoc40 AT>MFlashA512
|
||||
|
||||
/* DATA section for RamAHB32 */
|
||||
|
||||
.data_RAM3 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM3 = .) ;
|
||||
PROVIDE(__start_data_RamAHB32 = .) ;
|
||||
*(.ramfunc.$RAM3)
|
||||
*(.ramfunc.$RamAHB32)
|
||||
*(.data.$RAM3)
|
||||
*(.data.$RamAHB32)
|
||||
*(.data.$RAM3.*)
|
||||
*(.data.$RamAHB32.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM3 = .) ;
|
||||
PROVIDE(__end_data_RamAHB32 = .) ;
|
||||
} > RamAHB32 AT>MFlashA512
|
||||
|
||||
/* DATA section for RamAHB16 */
|
||||
|
||||
.data_RAM4 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM4 = .) ;
|
||||
PROVIDE(__start_data_RamAHB16 = .) ;
|
||||
*(.ramfunc.$RAM4)
|
||||
*(.ramfunc.$RamAHB16)
|
||||
*(.data.$RAM4)
|
||||
*(.data.$RamAHB16)
|
||||
*(.data.$RAM4.*)
|
||||
*(.data.$RamAHB16.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM4 = .) ;
|
||||
PROVIDE(__end_data_RamAHB16 = .) ;
|
||||
} > RamAHB16 AT>MFlashA512
|
||||
|
||||
/* DATA section for RamAHB_ETB16 */
|
||||
|
||||
.data_RAM5 : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
PROVIDE(__start_data_RAM5 = .) ;
|
||||
PROVIDE(__start_data_RamAHB_ETB16 = .) ;
|
||||
*(.ramfunc.$RAM5)
|
||||
*(.ramfunc.$RamAHB_ETB16)
|
||||
*(.data.$RAM5)
|
||||
*(.data.$RamAHB_ETB16)
|
||||
*(.data.$RAM5.*)
|
||||
*(.data.$RamAHB_ETB16.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_data_RAM5 = .) ;
|
||||
PROVIDE(__end_data_RamAHB_ETB16 = .) ;
|
||||
} > RamAHB_ETB16 AT>MFlashA512
|
||||
|
||||
/* MAIN DATA SECTION */
|
||||
.uninit_RESERVED (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
_start_uninit_RESERVED = .;
|
||||
KEEP(*(.bss.$RESERVED*))
|
||||
. = ALIGN(4) ;
|
||||
_end_uninit_RESERVED = .;
|
||||
} > RamLoc32 AT> RamLoc32
|
||||
|
||||
/* Main DATA section (RamLoc32) */
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
FILL(0xff)
|
||||
_data = . ;
|
||||
PROVIDE(__start_data_RAM = .) ;
|
||||
PROVIDE(__start_data_RamLoc32 = .) ;
|
||||
*(vtable)
|
||||
*(.ramfunc*)
|
||||
KEEP(*(CodeQuickAccess))
|
||||
KEEP(*(DataQuickAccess))
|
||||
*(RamFunction)
|
||||
*(.data*)
|
||||
. = ALIGN(4) ;
|
||||
_edata = . ;
|
||||
PROVIDE(__end_data_RAM = .) ;
|
||||
PROVIDE(__end_data_RamLoc32 = .) ;
|
||||
} > RamLoc32 AT>MFlashA512
|
||||
|
||||
/* BSS section for RamLoc40 */
|
||||
.bss_RAM2 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM2 = .) ;
|
||||
PROVIDE(__start_bss_RamLoc40 = .) ;
|
||||
*(.bss.$RAM2)
|
||||
*(.bss.$RamLoc40)
|
||||
*(.bss.$RAM2.*)
|
||||
*(.bss.$RamLoc40.*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM2 = .) ;
|
||||
PROVIDE(__end_bss_RamLoc40 = .) ;
|
||||
} > RamLoc40 AT> RamLoc40
|
||||
|
||||
/* BSS section for RamAHB32 */
|
||||
.bss_RAM3 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM3 = .) ;
|
||||
PROVIDE(__start_bss_RamAHB32 = .) ;
|
||||
*(.bss.$RAM3)
|
||||
*(.bss.$RamAHB32)
|
||||
*(.bss.$RAM3.*)
|
||||
*(.bss.$RamAHB32.*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM3 = .) ;
|
||||
PROVIDE(__end_bss_RamAHB32 = .) ;
|
||||
} > RamAHB32 AT> RamAHB32
|
||||
|
||||
/* BSS section for RamAHB16 */
|
||||
.bss_RAM4 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM4 = .) ;
|
||||
PROVIDE(__start_bss_RamAHB16 = .) ;
|
||||
*(.bss.$RAM4)
|
||||
*(.bss.$RamAHB16)
|
||||
*(.bss.$RAM4.*)
|
||||
*(.bss.$RamAHB16.*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM4 = .) ;
|
||||
PROVIDE(__end_bss_RamAHB16 = .) ;
|
||||
} > RamAHB16 AT> RamAHB16
|
||||
|
||||
/* BSS section for RamAHB_ETB16 */
|
||||
.bss_RAM5 : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_bss_RAM5 = .) ;
|
||||
PROVIDE(__start_bss_RamAHB_ETB16 = .) ;
|
||||
*(.bss.$RAM5)
|
||||
*(.bss.$RamAHB_ETB16)
|
||||
*(.bss.$RAM5.*)
|
||||
*(.bss.$RamAHB_ETB16.*)
|
||||
. = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */
|
||||
PROVIDE(__end_bss_RAM5 = .) ;
|
||||
PROVIDE(__end_bss_RamAHB_ETB16 = .) ;
|
||||
} > RamAHB_ETB16 AT> RamAHB_ETB16
|
||||
|
||||
/* MAIN BSS SECTION: EDIT change to RamLoc40 */
|
||||
.bss : ALIGN(4)
|
||||
{
|
||||
_bss = .;
|
||||
PROVIDE(__start_bss_RAM = .) ;
|
||||
PROVIDE(__start_bss_RamLoc32 = .) ;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4) ;
|
||||
_ebss = .;
|
||||
PROVIDE(__end_bss_RAM = .) ;
|
||||
PROVIDE(__end_bss_RamLoc32 = .) ;
|
||||
/* PROVIDE(end = .);*/
|
||||
} > RamLoc40 AT> RamLoc40 /* > RamLoc32 AT> RamLoc32 */
|
||||
|
||||
/* hathach add heap section for clang */
|
||||
.heap (NOLOAD): {
|
||||
__heap_start = .;
|
||||
__HeapBase = .;
|
||||
__heap_base = .;
|
||||
__end = .;
|
||||
PROVIDE(end = .);
|
||||
PROVIDE(_end = .);
|
||||
PROVIDE(__end__ = .);
|
||||
KEEP(*(.heap*))
|
||||
__HeapLimit = .;
|
||||
__heap_limit = .;
|
||||
__heap_end = .;
|
||||
} > RamLoc40
|
||||
|
||||
/* NOINIT section for RamLoc40 */
|
||||
.noinit_RAM2 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_noinit_RAM2 = .) ;
|
||||
PROVIDE(__start_noinit_RamLoc40 = .) ;
|
||||
*(.noinit.$RAM2)
|
||||
*(.noinit.$RamLoc40)
|
||||
*(.noinit.$RAM2.*)
|
||||
*(.noinit.$RamLoc40.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_noinit_RAM2 = .) ;
|
||||
PROVIDE(__end_noinit_RamLoc40 = .) ;
|
||||
} > RamLoc40 AT> RamLoc40
|
||||
|
||||
/* NOINIT section for RamAHB32 */
|
||||
.noinit_RAM3 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_noinit_RAM3 = .) ;
|
||||
PROVIDE(__start_noinit_RamAHB32 = .) ;
|
||||
*(.noinit.$RAM3)
|
||||
*(.noinit.$RamAHB32)
|
||||
*(.noinit.$RAM3.*)
|
||||
*(.noinit.$RamAHB32.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_noinit_RAM3 = .) ;
|
||||
PROVIDE(__end_noinit_RamAHB32 = .) ;
|
||||
} > RamAHB32 AT> RamAHB32
|
||||
|
||||
/* NOINIT section for RamAHB16 */
|
||||
.noinit_RAM4 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_noinit_RAM4 = .) ;
|
||||
PROVIDE(__start_noinit_RamAHB16 = .) ;
|
||||
*(.noinit.$RAM4)
|
||||
*(.noinit.$RamAHB16)
|
||||
*(.noinit.$RAM4.*)
|
||||
*(.noinit.$RamAHB16.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_noinit_RAM4 = .) ;
|
||||
PROVIDE(__end_noinit_RamAHB16 = .) ;
|
||||
} > RamAHB16 AT> RamAHB16
|
||||
|
||||
/* NOINIT section for RamAHB_ETB16 */
|
||||
.noinit_RAM5 (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
PROVIDE(__start_noinit_RAM5 = .) ;
|
||||
PROVIDE(__start_noinit_RamAHB_ETB16 = .) ;
|
||||
*(.noinit.$RAM5)
|
||||
*(.noinit.$RamAHB_ETB16)
|
||||
*(.noinit.$RAM5.*)
|
||||
*(.noinit.$RamAHB_ETB16.*)
|
||||
. = ALIGN(4) ;
|
||||
PROVIDE(__end_noinit_RAM5 = .) ;
|
||||
PROVIDE(__end_noinit_RamAHB_ETB16 = .) ;
|
||||
} > RamAHB_ETB16 AT> RamAHB_ETB16
|
||||
|
||||
/* DEFAULT NOINIT SECTION */
|
||||
.noinit (NOLOAD): ALIGN(4)
|
||||
{
|
||||
_noinit = .;
|
||||
PROVIDE(__start_noinit_RAM = .) ;
|
||||
PROVIDE(__start_noinit_RamLoc32 = .) ;
|
||||
*(.noinit*)
|
||||
. = ALIGN(4) ;
|
||||
_end_noinit = .;
|
||||
PROVIDE(__end_noinit_RAM = .) ;
|
||||
PROVIDE(__end_noinit_RamLoc32 = .) ;
|
||||
} > RamLoc32 AT> RamLoc32
|
||||
|
||||
/* PROVIDE(_pvHeapStart = DEFINED(__user_heap_base) ? __user_heap_base : .);*/
|
||||
|
||||
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_RamLoc32 - 0);
|
||||
|
||||
/* ## Create checksum value (used in startup) ## */
|
||||
/* This cause issue with clang linker, so it is disabled */
|
||||
/* MemManage_Handler, BusFault_Handler, UsageFault_Hander may not be defined */
|
||||
/* PROVIDE(__valid_user_code_checksum = 0 -*/
|
||||
/* (_vStackTop*/
|
||||
/* + (ResetISR + 1)*/
|
||||
/* + (NMI_Handler + 1)*/
|
||||
/* + (HardFault_Handler + 1)*/
|
||||
/* + (( DEFINED(MemManage_Handler) ? MemManage_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(BusFault_Handler) ? BusFault_Handler : 0 ) + 1)*/
|
||||
/* + (( DEFINED(UsageFault_Handler) ? UsageFault_Handler : 0 ) + 1)*/
|
||||
/* ) );*/
|
||||
|
||||
/* Provide basic symbols giving location and size of main text
|
||||
* block, including initial values of RW data sections. Note that
|
||||
* these will need extending to give a complete picture with
|
||||
* complex images (e.g multiple Flash banks).
|
||||
*/
|
||||
_image_start = LOADADDR(.text);
|
||||
_image_end = LOADADDR(.data) + SIZEOF(.data);
|
||||
_image_size = _image_end - _image_start;
|
||||
}
|
||||
Reference in New Issue
Block a user