-
Notifications
You must be signed in to change notification settings - Fork 977
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
Added NM180410 Board Support #1058
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d51de08
Added NM180410 support
joshua-nmi 71033d1
Added NM180410
joshua-nmi 08799da
Move drivers to parent directory
joshua-nmi 84d8388
Added LPC5516 variant
joshua-nmi 4faacde
renamed config file
joshua-nmi 35222df
Updated macros to support LPC5516
joshua-nmi 76503bd
Changed variant from LPC5516 to LPC55S26
joshua-nmi 4b75b1a
removed remant LPC551X references
joshua-nmi b805633
re-org lib and startup files based on compiler
joshua-nmi 5cc117c
implemented feedback from ARM
joshua-nmi 65d2b2d
renamed to lpc55s26 for consistency with NXP SDK
joshua-nmi a02c01c
Added definition for LPC552X
joshua-nmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/lpc55s26_bl.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
common: | ||
macros: | ||
- USB_PROD_STR="NM180410 DAPLink Bootloader" | ||
sources: | ||
board: | ||
- source/board/lpc55s26_bl.c | ||
- source/board/nm180410_bl.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
common: | ||
macros: | ||
- USB_PROD_STR="NM180410 DAPLink CMSIS-DAP" | ||
- IO_CONFIG_OVERRIDE | ||
- SWO_UART=1 | ||
- HID_LED_DEF=GPIO_LED_OFF | ||
- CDC_LED_DEF=GPIO_LED_OFF | ||
- MSC_LED_DEF=GPIO_LED_OFF | ||
includes: | ||
- source/board/override_nm180410 | ||
sources: | ||
board: | ||
- source/board/nm180410.c | ||
family: | ||
- source/family/ambiq/ama3b1kk/target.c | ||
- source/family/ambiq/ama3b1kk/target_reset.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_LPC55S26JBD64 | ||
- DAPLINK_HIC_ID=0x4C504355 # DAPLINK_HIC_ID_LPC55XX | ||
- OS_CLOCK=96000000 | ||
includes: | ||
- source/hic_hal/nxp/lpc55xx | ||
- source/hic_hal/nxp/lpc55xx/drivers | ||
- source/hic_hal/nxp/lpc55xx/LPC55S26 | ||
sources: | ||
hic_hal: | ||
- source/hic_hal/nxp/lpc55xx | ||
- source/hic_hal/nxp/lpc55xx/drivers | ||
- source/hic_hal/nxp/lpc55xx/LPC55S26 | ||
|
||
tool_specific: | ||
uvision: | ||
joshua-nmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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/LPC55S26/armcc | ||
- source/hic_hal/nxp/lpc55xx/LPC55S26/armcc/keil_lib_power.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/lpc55x/LPC55S26/armcc | ||
- source/hic_hal/nxp/lpc55xx/LPC55S26/armcc/keil_lib_power.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/LPC55S26/gcc | ||
- source/hic_hal/nxp/lpc55xx/LPC55S26/gcc/libpower_hardabi.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* @file lpc5516_bl.c | ||
joshua-nmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @brief board ID and meta-data for the hardware interface circuit (HIC) based on the NXP LPC5516 | ||
joshua-nmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* 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 = { | ||
.version = kTargetConfigVersion, | ||
.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 = 0x20018000, | ||
/* .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://daplink.io", | ||
.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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* @file nm180410.c | ||
* @brief board ID for the Northern Mechatronics NM180410 board | ||
* | ||
* DAPLink Interface Firmware | ||
* Copyright (c) 2009-2023, 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 "fsl_clock.h" | ||
#include "fsl_iocon.h" | ||
#include "pin_mux.h" | ||
|
||
#include "target_board.h" | ||
#include "target_family.h" | ||
|
||
const board_info_t g_board_info = { | ||
.info_version = kBoardInfoVersion, | ||
.family_id = kAmbiq_ama3b1kk_FamilyID, | ||
.target_cfg = &target_device, | ||
.daplink_url_name = "NMI HTM", | ||
.daplink_drive_name = "NMI ", | ||
.daplink_target_url = "https://www.northernmechatronics.com", | ||
.board_vendor = "Northern Mechatronics", | ||
.board_name = "NM180410 Petal Development Board", | ||
.board_id = "D000", | ||
}; | ||
|
||
void board_gpio_init(void) | ||
{ | ||
/* Enables the clock for the I/O controller.: Enable Clock. */ | ||
CLOCK_EnableClock(kCLOCK_Iocon); | ||
|
||
const uint32_t port0_pin29_config = (/* Pin is configured as FC0_RXD_SDA_MOSI_DATA */ | ||
IOCON_PIO_FUNC1 | | ||
/* No addition pin function */ | ||
IOCON_PIO_MODE_INACT | | ||
/* Standard mode, output slew rate control is enabled */ | ||
IOCON_PIO_SLEW_STANDARD | | ||
/* Input function is not inverted */ | ||
IOCON_PIO_INV_DI | | ||
/* Enables digital function */ | ||
IOCON_PIO_DIGITAL_EN | | ||
/* Open drain is disabled */ | ||
IOCON_PIO_OPENDRAIN_DI); | ||
/* PORT0 PIN29 (coords: 92) is configured as FC0_RXD_SDA_MOSI_DATA */ | ||
IOCON_PinMuxSet(IOCON, 0U, 29U, port0_pin29_config); | ||
|
||
const uint32_t port0_pin30_config = (/* Pin is configured as FC0_TXD_SCL_MISO_WS */ | ||
IOCON_PIO_FUNC1 | | ||
/* No addition pin function */ | ||
IOCON_PIO_MODE_INACT | | ||
/* Standard mode, output slew rate control is enabled */ | ||
IOCON_PIO_SLEW_STANDARD | | ||
/* Input function is not inverted */ | ||
IOCON_PIO_INV_DI | | ||
/* Enables digital function */ | ||
IOCON_PIO_DIGITAL_EN | | ||
/* Open drain is disabled */ | ||
IOCON_PIO_OPENDRAIN_DI); | ||
/* PORT0 PIN30 (coords: 94) is configured as FC0_TXD_SCL_MISO_WS */ | ||
IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DAPLINK_HIC_ID=0x4C509955 # DAPLINK_HIC_ID_LPC552X