Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LPC55xx HIC support to experimental_compilers #803

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2ec5a95
Define flash HAL API for testing if flash is readable before accessing.
flit Dec 11, 2020
5aaa464
CMSIS-DAP: prepare for custom SWD implementation.
flit Dec 20, 2020
985bfe7
Add LPC55xx family ID.
flit Jan 6, 2020
b253a38
LPC55xx: started adding HIC files.
flit Oct 28, 2019
81dabcb
LPC55xx: cleaned up fsl_iocon.h.
flit Dec 15, 2020
ecc0fb3
LPC55xx: added DAPLink info to gcc vector table.
flit Dec 11, 2020
6b46efc
LPC55xx: daplink_addr.h memory map.
flit Dec 7, 2020
226ecc0
LPC55xx: IO_Config.h pin map.
flit Dec 7, 2020
2c29467
LPC55xx: internal flash driver.
flit Dec 7, 2020
c0b356b
LPC55xx: read UID implementation.
flit Dec 7, 2020
07b385f
LPC55xx: Initial stab at uart.c port to fsl_uart_cmsis API
mbrossard Dec 8, 2020
6d01368
LPC55xx: override validate_bin_nvic for bootloader.
flit Dec 10, 2020
905d7f6
LPC55xx: (FIXME) temporarily disabled CRC computation in info.c.
flit Dec 11, 2020
dff878c
LPC55xx: clock init.
flit Dec 18, 2020
2511e78
LPC55xx: USB device is enumerating.
flit Dec 13, 2020
4d3854f
LPC55xx: few more USBD fixes.
flit Dec 18, 2020
b14e642
LPC55xx: customized USB product strings for bl and if.
flit Dec 15, 2020
5a834ea
LPC55xx: update info.py.
flit Dec 15, 2020
ffcabd9
LPC55xx: initial IO implementation.
flit Dec 16, 2020
059108f
LPC55xx: enable CM33 support in RTX5.
flit Dec 16, 2020
b907677
LPC55xx: correct initial EXC_RETURN for v8-M NS.
flit Dec 17, 2020
ccbcf37
LPC55xx: working DAP_config.h.
flit Dec 19, 2020
8e07855
LPC55xx: add some SDK drivers.
flit Dec 19, 2020
1a76171
LPC55xx: fix use of system include in pin_mux.c.
flit Dec 24, 2020
0a9f147
LPC55xx: increase main stack size to 0x800.
flit Dec 25, 2020
82c3c84
LPC55xx: hardware CRC32 with flash readability checking.
flit Dec 25, 2020
90f6baf
LPC55xx: re-enable CRC computation in info.c.
flit Dec 25, 2020
a469517
LPC55xx: fix dumb inverted assert condition in flash_is_readable().
flit Dec 25, 2020
0e0f07e
LPC55xx: fix validate_bin_nvic_base().
flit Dec 25, 2020
5966b1d
LPC55xx: fix library path
mbrossard Jan 2, 2021
363870e
LPC55xx: correct bootloader target_device RAM regions addresses.
flit Jan 1, 2021
308f7ac
Update CMSIS Core headers.
flit Jan 4, 2021
844a406
Set __PROGRAM_START macro to force CMSIS __cmsis_start() to be removed.
flit Jan 5, 2021
bcdc9f4
LPC55xx: fix RTOS2 tick configuration
mbrossard Apr 21, 2021
90ba4ec
LPC55xx: Add interface firmware to info.py and armcc/armclang build w…
mbrossard Apr 22, 2021
9934a71
LPC5xx: Connect HW_VERS6 and HW_VERS7 to reset functionality
mathias-arm Apr 22, 2021
6945ae8
Upload .hex version of bootloader in addition to .bin
mbrossard Apr 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
python tools/progen_compile.py --release --parallel -v -v --ignore-failures
(ls -lR firmware_*; ccache -s; arm-none-eabi-gcc -v) | tee log.txt
mkdir bootloaders
cp projectfiles/make_gcc_arm/*_bl/build/*_crc.bin bootloaders
cp projectfiles/make_gcc_arm/*_bl/build/*_crc.{bin,hex} bootloaders

- name: Upload test artifacts
uses: actions/upload-artifact@v2
Expand Down
13 changes: 13 additions & 0 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ module:
- records/rtos/rtos-cm3.yaml
- records/hic_hal/lpc4322.yaml
- records/usb/usb-bulk.yaml
hic_lpc55s69: &module_hic_lpc55s69
- records/rtos/rtos-cm33.yaml
- records/hic_hal/lpc55s69.yaml
- records/usb/usb-bulk.yaml
hic_sam3u2c: &module_hic_sam3u2c
- records/rtos/rtos-cm3.yaml
- records/hic_hal/sam3u2c.yaml
Expand Down Expand Up @@ -124,6 +128,15 @@ projects:
- *module_if
- *module_hic_lpc4322
- records/family/all_family.yaml
lpc55s69_bl:
- *module_bl
- records/hic_hal/lpc55s69.yaml
- records/board/lpc55s69_bl.yaml
lpc55s69_if:
- *module_if
- *module_hic_lpc55s69
- records/board/lpc55s69_if.yaml # Sets the USB product string.
- records/family/all_family.yaml
max32620_bl:
- *module_bl
- records/hic_hal/max32620.yaml
Expand Down
6 changes: 6 additions & 0 deletions records/board/lpc55s69_bl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
common:
macros:
- USB_PROD_STR="LPC55xx DAPLink Bootloader"
sources:
board:
- source/board/lpc55s69_bl.c
3 changes: 3 additions & 0 deletions records/board/lpc55s69_if.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
common:
macros:
- USB_PROD_STR="LPC55xx DAPLink CMSIS-DAP"
74 changes: 74 additions & 0 deletions records/hic_hal/lpc55s69.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
common:
target:
- cortex-m33
core:
- Cortex-M33
macros:
- INTERFACE_LPC55XX
- CPU_LPC55S69JBD64_cm33_core0
- DAPLINK_HIC_ID=0x4C504355 # DAPLINK_HIC_ID_LPC55XX
- OS_CLOCK=150000000
includes:
- source/hic_hal/nxp/lpc55xx
- source/hic_hal/nxp/lpc55xx/LPC55S69
- source/hic_hal/nxp/lpc55xx/LPC55S69/drivers
sources:
hic_hal:
- source/hic_hal/nxp/lpc55xx
- source/hic_hal/nxp/lpc55xx/LPC55S69
- source/hic_hal/nxp/lpc55xx/LPC55S69/drivers

tool_specific:
uvision:
misc:
ld_flags:
- --predefine="-I../../../source/hic_hal/nxp/lpc55xx"
c_flags:
- --no_unaligned_access
- --diag_suppress=66 # disable warning about enums not fitting in signed 32-bit
cxx_flags:
- --no_unaligned_access
asm_flags:
- --no_unaligned_access
includes:
- projectfiles/uvision/lpc55xx_bl/build
sources:
hic_hal:
- source/hic_hal/nxp/lpc55xx/armcc
- source/hic_hal/nxp/lpc55xx/LPC55S69/armcc/keil_lib_power_cm33_core0.lib
armcc:
misc:
ld_flags:
- --predefine="-Isource/hic_hal/nxp/lpc55xx"
c_flags:
- --no_unaligned_access
- --diag_suppress=66 # disable warning about enums not fitting in signed 32-bit
cxx_flags:
- --no_unaligned_access
asm_flags:
- --no_unaligned_access
includes:
- projectfiles/make_armcc/lpc55xx_bl/build
sources:
hic_hal:
- source/hic_hal/nxp/lpc55xx/armcc
- source/hic_hal/nxp/lpc55xx/LPC55S69/armcc/keil_lib_power_cm33_core0.lib
gcc_arm:
misc:
c_flags:
- -march=armv8-m.main+fp+dsp
- -mfloat-abi=hard
- -mfpu=fpv5-sp-d16
ld_flags:
- -march=armv8-m.main+fp+dsp
- -mfloat-abi=hard
- -mfpu=fpv5-sp-d16
- -Wl,--defsym=__stack_size__=0x800
linker_file:
- source/hic_hal/nxp/lpc55xx/gcc/lpc55xx.ld
includes:
- source/hic_hal/nxp/lpc55xx/gcc
sources:
hic_hal:
- source/hic_hal/nxp/lpc55xx/gcc
- source/hic_hal/nxp/lpc55xx/LPC55S69/gcc/libpower_hardabi.a
36 changes: 36 additions & 0 deletions records/rtos/rtos-cm33.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
common:
macros:
- OS_TICK_FREQ=100
includes:
- source/rtos2/Include
- source/rtos2/RTX/Include
- source/rtos2/RTX/Config
sources:
rtos:
- source/rtos2/RTX/Config/RTX_Config.c
- source/rtos2/RTX/Source/rtx_delay.c
- source/rtos2/RTX/Source/rtx_evr.c
- source/rtos2/RTX/Source/rtx_kernel.c
- source/rtos2/RTX/Source/rtx_lib.c
- source/rtos2/RTX/Source/rtx_memory.c
- source/rtos2/RTX/Source/rtx_mempool.c
- source/rtos2/RTX/Source/rtx_msgqueue.c
- source/rtos2/RTX/Source/rtx_mutex.c
- source/rtos2/RTX/Source/rtx_system.c
- source/rtos2/RTX/Source/rtx_thread.c
- source/rtos2/RTX/Source/rtx_timer.c
- source/rtos2/Source/os_systick.c

# Note: For armcc, do not use NS version! We don't want the TZ context support.
tool_specific:
uvision:
sources:
rtos:
- source/rtos2/RTX/Source/ARM/irq_armv8mml.s
armcc:
sources:
rtos:
- source/rtos2/RTX/Source/ARM/irq_armv8mml.s
gcc_arm:
sources:
- source/rtos2/RTX/Source/GCC/irq_armv8mml.S
2 changes: 1 addition & 1 deletion records/tools/armcc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tool_specific:
mcu:
- cortex-m0
macros:
-
- __PROGRAM_START
linker_file:
- source/daplink/daplink.sct
misc:
Expand Down
2 changes: 1 addition & 1 deletion records/tools/armclang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tool_specific:
mcu:
- cortex-m0
macros:
-
- __PROGRAM_START
linker_file:
- source/daplink/daplink.sct
misc:
Expand Down
4 changes: 1 addition & 3 deletions records/tools/gcc_arm.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
tool_specific:
gcc_arm:
mcu:
- cortex-m0
macros:
-
- __PROGRAM_START
linker_file:
- source/daplink/daplink.ld
misc:
Expand Down
2 changes: 1 addition & 1 deletion source/board/hani_iot.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0360",
.family_id = VENDOR_TO_FAMILY(kNXP_VendorID, 0), //ID not maching the predefined family ids
.family_id = kNXP_LPC55xx_FamilyID, //ID not maching the predefined family ids
.flags = kEnablePageErase,
.daplink_url_name = "PRODINFOHTM",
.daplink_drive_name = "HANI_IOT",
Expand Down
2 changes: 1 addition & 1 deletion source/board/lpc55S69xpresso.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0236",
.family_id = VENDOR_TO_FAMILY(kNXP_VendorID, 0), //ID not maching the predefined family ids
.family_id = kNXP_LPC55xx_FamilyID,
.flags = kEnablePageErase,
.daplink_url_name = "PRODINFOHTM",
.daplink_drive_name = "LPC55S69",
Expand Down
100 changes: 100 additions & 0 deletions source/board/lpc55s69_bl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* @file lpc55s69_bl.c
* @brief board ID and meta-data for the hardware interface circuit (HIC) based on the NXP LPC55S69
*
* DAPLink Interface Firmware
* Copyright (c) 2019-2020, Arm Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed 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 "target_config.h"
#include "daplink_addr.h"
#include "compiler.h"
#include "target_board.h"
#include "target_family.h"
#include "validation.h"
#include "flash_hal.h"

// Warning - changing the interface start will break backwards compatibility
COMPILER_ASSERT(DAPLINK_ROM_IF_START == (DAPLINK_ROM_START + KB(64)));

static uint8_t lpc55xx_bootloader_validate_nvic(const uint8_t *buf);

/**
* List of start and size for each size of flash sector
* The size will apply to all sectors between the listed address and the next address
* in the list.
* The last pair in the list will have sectors starting at that address and ending
* at address start + size.
*/
static const sector_info_t sectors_info[] = {
{DAPLINK_ROM_IF_START, DAPLINK_SECTOR_SIZE},
};

// lpc55s69 target information
target_cfg_t target_device = {
.sectors_info = sectors_info,
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
.flash_regions[0].start = DAPLINK_ROM_IF_START,
.flash_regions[0].end = DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE,
.flash_regions[0].flags = kRegionIsDefault,
.ram_regions[0].start = 0x20000000,
.ram_regions[0].end = 0x20040000,
/* .flash_algo not needed for bootloader */
};

/*!
* Special target family for the LPC55xx bootloader. It's only purpose is to override the
* validate_bin_nvic() routine to prevent bus faults from attempting to read erased flash.
*/
static const target_family_descriptor_t g_lpc55xx_bootloader_family = {
.family_id = 0,
.validate_bin_nvic = lpc55xx_bootloader_validate_nvic,
};

const target_family_descriptor_t *g_target_family = &g_lpc55xx_bootloader_family;

const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "0000",
.daplink_url_name = "HELP_FAQHTM",
.daplink_drive_name = "BOOTLOADER",
.daplink_target_url = "https://mbed.com/daplink",
.target_cfg = &target_device,
};

//! @brief Customized NVIC validator.
//!
//! This NVIC validator first checks if the passed-in address points to the internal flash
//! memory. If so, an initial check is made to see if the flash is erased. If it is, then we
//! can't read from it or the flash controller will generate a bus fault. If the address is
//! either outside of flash, such as testing a new interface image in RAM, or the flash
//! sector is programmed, then the standard NVIC validator is called.
uint8_t lpc55xx_bootloader_validate_nvic(const uint8_t *buf)
{
uint32_t addr = (uint32_t)buf;

// If the address within internal flash?
if (addr >= DAPLINK_ROM_START && addr < (DAPLINK_ROM_START + DAPLINK_ROM_SIZE)) {
// If the flash sector is erased, then report that the NVIC is invalid. Otherwise
// continue below and perform the usual NVIC validation test.
if (!flash_is_readable(addr, 32)) {
return 0;
}
}

// Call original implementation.
return validate_bin_nvic_base(buf);
}
Loading