forked from ARMmbed/DAPLink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for LPC55S69Xpresso board
Signed-off-by: Mahesh Mahadevan <[email protected]>
- Loading branch information
1 parent
c3c1fd1
commit b94ca18
Showing
7 changed files
with
325 additions
and
0 deletions.
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,7 @@ | ||
common: | ||
sources: | ||
board: | ||
- source/board/lpc55S69xpresso.c | ||
target: | ||
- source/target/nxp/lpc55S6X/target.c | ||
- source/target/nxp/lpc55S6X/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,43 @@ | ||
/** | ||
* @file lpc55S69xpresso.c | ||
* @brief board ID for the NXP LPC54608Xpresso board | ||
* | ||
* DAPLink Interface Firmware | ||
* Copyright (c) 2009-2017, 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 "virtual_fs.h" | ||
#include "flash_manager.h" | ||
|
||
const char *board_id = "0236"; | ||
|
||
// Override default behavior | ||
// | ||
// URL_NAME and DRIVE_NAME must be 11 characters excluding | ||
// the null terminated character | ||
// Note - 4 byte alignemnt required as workaround for ARMCC compiler bug with weak references | ||
__attribute__((aligned(4))) | ||
const vfs_filename_t daplink_url_name = "PRODINFOHTM"; | ||
__attribute__((aligned(4))) | ||
const vfs_filename_t daplink_drive_name = "LPC55S69"; | ||
__attribute__((aligned(4))) | ||
const char *const daplink_target_url = "https://os.mbed.com/platforms/LPCXpresso55S69/"; | ||
|
||
void prerun_board_config(void) | ||
{ | ||
flash_manager_set_page_erase(true); | ||
} | ||
|
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,104 @@ | ||
/* Flash OS Routines (Automagically Generated) | ||
* Copyright (c) 2009-2015 ARM Limited | ||
* | ||
* 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. | ||
*/ | ||
|
||
static const uint32_t lpc55S69_flash_prog_blob[] = { | ||
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, | ||
0x20c8b580, 0x0002f2c4, 0x60012120, 0x6080f64f, 0x4100f240, 0x70fff6cf, 0x0100f2c4, 0x500a2200, | ||
0x6084f64f, 0x70fff6cf, 0x6808500a, 0x6300f04f, 0x30f8f440, 0xf64f6008, 0xf6cf5048, 0x500b70ff, | ||
0x6028f64f, 0x70fff6cf, 0xf243500b, 0xf2c40010, 0x68030001, 0x4380f443, 0xf8416003, 0xf04f2c80, | ||
0x21024080, 0xf2406001, 0xf2c0000c, 0x44480000, 0xf862f000, 0xbf182800, 0xbd802001, 0x47702000, | ||
0xf240b510, 0xf2c0040c, 0xf2460400, 0xeb09636c, 0xf6c60004, 0x21003365, 0x2218f44f, 0xf86cf000, | ||
0xbf182800, 0xeb09bd10, 0x21000004, 0x2218f44f, 0x4010e8bd, 0xb8b0f000, 0xf240b5b0, 0xf2c0050c, | ||
0xeb090500, 0x690a0105, 0xf2464604, 0xf6c6636c, 0x46083365, 0xf0004621, 0x2800f84f, 0xbdb0bf18, | ||
0x0005eb09, 0x46216902, 0x40b0e8bd, 0xb894f000, 0xb085b5f0, 0x070cf240, 0x4606460d, 0x0700f2c0, | ||
0x0007eb09, 0x462b4631, 0xf0004614, 0xb108f85d, 0xbdf0b005, 0xf10da804, 0x90000c0c, 0x0007eb09, | ||
0x462a4631, 0xf8cd4623, 0xf000c004, 0xb005f88b, 0x0000bdf0, 0xe7fdbe00, 0x1100f241, 0x3100f2c1, | ||
0x29006809, 0x680ad00a, 0x0308f240, 0x2207f3c2, 0x0300f2c0, 0x2003f849, 0x47086849, 0x309ef240, | ||
0x0000f2c0, 0x31abf240, 0x0100f2c0, 0x44794478, 0xf7ff2276, 0xbf00ffdf, 0x0c08f240, 0x0c00f2c0, | ||
0xc00cf859, 0x0f00f1bc, 0xf241d00b, 0xf2c11c00, 0xf8dc3c00, 0xf1bcc000, 0xd0070f00, 0xc008f8dc, | ||
0xf2444760, 0xf2c11c3b, 0x47603c00, 0x304ef240, 0x0000f2c0, 0x315bf240, 0x0100f2c0, 0x44794478, | ||
0xf7ff2286, 0xbf00ffb7, 0x0c08f240, 0x0c00f2c0, 0xc00cf859, 0x0f00f1bc, 0xf241d00b, 0xf2c11c00, | ||
0xf8dc3c00, 0xf1bcc000, 0xd0070f00, 0xc00cf8dc, 0xf2444760, 0xf2c11c9d, 0x47603c00, 0x20fef240, | ||
0x0000f2c0, 0x310bf240, 0x0100f2c0, 0x44794478, 0xf7ff2296, 0xbf00ff8f, 0x1300f241, 0x3300f2c1, | ||
0x2b00681b, 0x691bd001, 0xf2404718, 0xf2c020d0, 0xf2400000, 0xf2c021dd, 0x44780100, 0x229e4479, | ||
0xff78f7ff, 0x0c08f240, 0x0c00f2c0, 0xc00cf859, 0x0f00f1bc, 0xf241d00b, 0xf2c11c00, 0xf8dc3c00, | ||
0xf1bcc000, 0xd0070f00, 0xc014f8dc, 0xf2444760, 0xf2c12c7d, 0x47603c00, 0x2082f240, 0x0000f2c0, | ||
0x218ff240, 0x0100f2c0, 0x44794478, 0xf7ff22b2, 0xbf00ff51, 0x1300f241, 0x3300f2c1, 0x2b00681b, | ||
0x699bd001, 0xf2404718, 0xf2c02054, 0xf2400000, 0xf2c02161, 0x44780100, 0x22bb4479, 0xff3af7ff, | ||
0x1100f241, 0x3100f2c1, 0x29006809, 0x69c9d001, 0xf2404708, 0xf2c02028, 0xf2400000, 0xf2c02135, | ||
0x44780100, 0x22c54479, 0xff24f7ff, 0x1100f241, 0x3100f2c1, 0x29006809, 0x6a09d001, 0xf2404708, | ||
0xf2c010fc, 0xf2400000, 0xf2c02109, 0x44780100, 0x22cc4479, 0xff0ef7ff, 0x1100f241, 0x3100f2c1, | ||
0x29006809, 0xf644d004, 0xf2c11151, 0x47083100, 0x10caf240, 0x0000f2c0, 0x11d7f240, 0x0100f2c0, | ||
0x44794478, 0xf7ff22d2, 0xbf00fef5, 0x230bf644, 0x3300f2c1, 0xbf004718, 0x1c00f241, 0x3c00f2c1, | ||
0xc000f8dc, 0x0f00f1bc, 0xf8dcd002, 0x4760c040, 0x108af240, 0x0000f2c0, 0x1197f240, 0x0100f2c0, | ||
0x44794478, 0xf7ff22e0, 0xbf00fed5, 0x21fff644, 0x3100f2c1, 0xbf004708, 0x313df644, 0x3100f2c1, | ||
0xbf004708, 0x1200f241, 0x3200f2c1, 0x2a006812, 0xf644d004, 0xf2c1328b, 0x47103200, 0x103ef240, | ||
0x0000f2c0, 0x114bf240, 0x0100f2c0, 0x44794478, 0xf7ff22f5, 0xbf00feaf, 0x1300f241, 0x3300f2c1, | ||
0x2b00681b, 0x6a5bd001, 0xf2404718, 0xf2c01010, 0xf2400000, 0xf2c0111d, 0x44780100, 0x22fc4479, | ||
0xfe98f7ff, 0x62a7f644, 0x3200f2c1, 0xbf004710, 0x1c00f241, 0x3c00f2c1, 0xc000f8dc, 0x0f00f1bc, | ||
0xf8dcd002, 0x4760c02c, 0x00d2f240, 0x0000f2c0, 0x01dff240, 0x0100f2c0, 0x44794478, 0x7284f44f, | ||
0xfe78f7ff, 0x1200f241, 0x3200f2c1, 0x2a006812, 0x6b12d001, 0xf2404710, 0xf2c000a4, 0xf2400000, | ||
0xf2c001b1, 0x44780100, 0xf2404479, 0xf7ff120f, 0xbf00fe61, 0x1200f241, 0x3200f2c1, 0x2a006812, | ||
0x6b52d001, 0xf2404710, 0xf2c00074, 0xf2400000, 0xf2c00181, 0x44780100, 0xf44f4479, 0xf7ff728b, | ||
0xbf00fe49, 0x1300f241, 0x3300f2c1, 0x2b00681b, 0x6b9bd001, 0xf2404718, 0xf2c00044, 0xf2400000, | ||
0xf2c00151, 0x44780100, 0xf2404479, 0xf7ff121d, 0xbf00fe31, 0x6c15f644, 0x3c00f2c1, 0xbf004760, | ||
0x1200f241, 0x3200f2c1, 0x2a006812, 0x6a92d001, 0xf2404710, 0xf2c00008, 0xf2400000, 0xf2c00115, | ||
0x44780100, 0xf44f4479, 0xf7ff7295, 0x4c46fe13, 0x5f485341, 0x5f495041, 0x45455254, 0x2f2e2e00, | ||
0x2e2f2e2e, 0x6f732f2e, 0x65637275, 0x70786e2f, 0x63706c2f, 0x36533535, 0x73662f39, 0x61695f6c, | ||
0x00632e70, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | ||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | ||
0x00000000, 0x00000000, 0x00000000 | ||
}; | ||
|
||
// Start address of flash | ||
static const uint32_t flash_start = 0x00000000; | ||
// Size of flash | ||
static const uint32_t flash_size = 0x00098000; | ||
|
||
/** | ||
* List of start and size for each size of flash sector - even indexes are start, odd are size | ||
* 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 flash_start + flash_size. | ||
*/ | ||
static const uint32_t sectors_info[] = { | ||
0x00000000, 0x00008000, | ||
}; | ||
|
||
static const program_target_t flash = { | ||
0x20000021, // Init | ||
0x2000009d, // UnInit | ||
0x200000a1, // EraseChip | ||
0x200000d9, // EraseSector | ||
0x20000111, // ProgramPage | ||
0x0, // Verify | ||
|
||
// BKPT : start of blob + 1 | ||
// RSB : blob start + header + rw data offset | ||
// RSP : stack pointer | ||
{ | ||
0x20000001, | ||
0x20000564, | ||
0x20000800 | ||
}, | ||
|
||
0x20000000 + 0x00000A00, // mem buffer location | ||
0x20000000, // location to write prog_blob in target RAM | ||
sizeof(lpc55S69_flash_prog_blob), // prog_blob size | ||
lpc55S69_flash_prog_blob, // address of prog_blob | ||
0x00000200 // ram_to_flash_bytes_to_be_written | ||
}; |
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,40 @@ | ||
/** | ||
* @file target.c | ||
* @brief Target information for the lpc55S6X | ||
* | ||
* DAPLink Interface Firmware | ||
* Copyright (c) 2009-2016, 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" | ||
|
||
// The file flash_blob.c must only be included in target.c | ||
#include "flash_blob.c" | ||
|
||
// target information | ||
target_cfg_t target_device = { | ||
.sector_size = 32768, | ||
.sector_cnt = (KB(608) / 32768), | ||
.flash_start = 0, | ||
.flash_end = KB(608), | ||
.ram_start = 0x20000000, | ||
.ram_end = 0x20044000, | ||
.flash_algo = (program_target_t *) &flash, | ||
.extra_flash[0].start = 0x10000000, | ||
.extra_flash[0].end = 0x10000000 + KB(608), | ||
.extra_ram[0].start = 0x30000000, | ||
.extra_ram[0].end = 0x30000000 + 0x00044000, | ||
}; |
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,125 @@ | ||
/** | ||
* @file target_reset.c | ||
* @brief Target reset for the lpc812 | ||
* | ||
* DAPLink Interface Firmware | ||
* Copyright (c) 2009-2016, 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_reset.h" | ||
#include "swd_host.h" | ||
#include "RTL.h" | ||
|
||
#define DBG_Addr (0xE000EDF0) | ||
#define DWT_COMP0 (0xE0001020) | ||
#define DWT_FUNCTION0 (0xE0001028) | ||
#define DWT_FUNCTION_MATCH (0x4 << 0) | ||
#define DWT_FUNCTION_ACTION (0x1 << 4) | ||
#define DWT_FUNCTION_DATAVSIZE (0x2 << 10) | ||
|
||
/* Debug mailbox AP registers */ | ||
#define DEBUGMB_CSW 0x02000000 | ||
#define DEBUGMB_REQ 0x02000004 | ||
#define DEBUGMB_RET 0x02000008 | ||
#define DEBUGMB_ID 0x020000FC | ||
|
||
void target_before_init_debug(void) | ||
{ | ||
return; | ||
} | ||
|
||
uint8_t target_unlock_sequence(void) | ||
{ | ||
return 1; | ||
} | ||
|
||
|
||
|
||
uint8_t target_set_state(TARGET_RESET_STATE state) | ||
{ | ||
uint32_t val; | ||
int8_t ap_retries = 2; | ||
|
||
if (state == RESET_PROGRAM) { | ||
if (!swd_init_debug()) { | ||
return 0; | ||
} | ||
|
||
// Enable debug | ||
while(swd_write_word(DBG_HCSR, DBGKEY | C_DEBUGEN) == 0) { | ||
if( --ap_retries <=0 ) | ||
return 0; | ||
// Target is in invalid state? | ||
swd_set_target_reset(1); | ||
os_dly_wait(2); | ||
swd_set_target_reset(0); | ||
os_dly_wait(2); | ||
} | ||
|
||
// Set Trace Enable bit | ||
if (!swd_read_word(DBG_EMCR, &val)) { | ||
return 0; | ||
} | ||
|
||
if (!swd_write_word(DBG_EMCR, val | TRCENA)) { | ||
return 0; | ||
} | ||
|
||
// Clear the comparator function register | ||
if (!swd_write_word(DWT_FUNCTION0, 0x0)) { | ||
return 0; | ||
} | ||
|
||
// Set the address | ||
if (!swd_write_word(DWT_COMP0, 0x50000040)) { | ||
return 0; | ||
} | ||
|
||
// Update the comparator function register | ||
if (!swd_write_word(DWT_FUNCTION0, (DWT_FUNCTION_MATCH | DWT_FUNCTION_ACTION | DWT_FUNCTION_DATAVSIZE))) { | ||
return 0; | ||
} | ||
|
||
// Reset using the debug mailbox | ||
if (!swd_write_ap(DEBUGMB_CSW, 0x20)) { | ||
return 0; | ||
} | ||
|
||
os_dly_wait(5); | ||
|
||
do { | ||
if (!swd_read_word(DBG_HCSR, &val)) { | ||
return 0; | ||
} | ||
} while ((val & S_HALT) == 0); | ||
|
||
// Disable halt on reset | ||
if (!swd_write_word(DBG_EMCR, 0)) { | ||
return 0; | ||
} | ||
|
||
return 1; | ||
|
||
} else { | ||
return swd_set_target_state_sw(state); | ||
} | ||
} | ||
|
||
uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size) | ||
{ | ||
return 0; | ||
} | ||
|
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