Skip to content

Add bootloader support for the LPC55S69 board #10086

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

Merged
merged 1 commit into from
Mar 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "bootloader_LPC55S69",
"target_overrides": {
"*": {
"target.app_offset": "0x8400",
"target.header_offset": "0x8000",
"target.bootloader_img": "mbed-bootloader-lpc55s69-v1_0_0.hex"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this bootloader do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see https://os.mbed.com/docs/mbed-os/v5.11/tutorials/bootloader.html (Prebuilt bootloaders section)

}
}
}
4 changes: 2 additions & 2 deletions platform/mbed_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static void powerdown_nvic()
NVIC->ICER[i] = 0xFFFFFFFF;
NVIC->ICPR[i] = 0xFFFFFFFF;
for (j = 0; j < 8; j++) {
#if defined(__CORTEX_M23)
#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
NVIC->IPR[i * 8 + j] = 0x00000000;
#else
NVIC->IP[i * 8 + j] = 0x00000000;
Expand All @@ -132,7 +132,7 @@ static void powerdown_scb(uint32_t vtor)
num_pri_reg = 12;
#endif
for (i = 0; i < num_pri_reg; i++) {
#if defined(__CORTEX_M7) || defined(__CORTEX_M23)
#if defined(__CORTEX_M7) || defined(__CORTEX_M23) || defined(__CORTEX_M33)
SCB->SHPR[i] = 0x00;
#else
SCB->SHP[i] = 0x00;
Expand Down
2 changes: 1 addition & 1 deletion platform/mbed_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include<stdint.h>

#if defined(__CORTEX_M0PLUS) || defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7)\
|| defined(__CORTEX_M23) || defined(__CORTEX_A9)
|| defined(__CORTEX_M23) || defined(__CORTEX_A9) || defined(__CORTEX_M33)
#define MBED_APPLICATION_SUPPORT 1
#else
#define MBED_APPLICATION_SUPPORT 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@
#define MBED_ROM_START NS_CODE_START
#endif

#if !defined(MBED_APP_START)
#define MBED_APP_START MBED_ROM_START
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE NS_CODE_SIZE
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE MBED_ROM_SIZE
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START NS_DATA_START
#endif
Expand All @@ -70,11 +78,11 @@
#endif


#define m_interrupts_start MBED_ROM_START
#define m_interrupts_start MBED_APP_START
#define m_interrupts_size 0x140

#define m_text_start MBED_ROM_START + 0x140
#define m_text_size MBED_ROM_SIZE - 0x140
#define m_text_start MBED_APP_START + 0x140
#define m_text_size MBED_APP_SIZE - 0x140

#define m_interrupts_ram_start MBED_RAM_START
#define m_interrupts_ram_size __ram_vector_table_size__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ __ram_vector_table__ = 1;
#define MBED_ROM_START NS_CODE_START
#endif

#if !defined(MBED_APP_START)
#define MBED_APP_START MBED_ROM_START
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE NS_CODE_SIZE
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE MBED_ROM_SIZE
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START NS_DATA_START
#endif
Expand All @@ -56,8 +64,8 @@ M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x200 : 0x0;

MEMORY
{
m_interrupts (RX) : ORIGIN = MBED_ROM_START, LENGTH = 0x140
m_text (RX) : ORIGIN = MBED_ROM_START + 0x140, LENGTH = MBED_ROM_SIZE - 0x140
m_interrupts (RX) : ORIGIN = MBED_APP_START, LENGTH = 0x140
m_text (RX) : ORIGIN = MBED_APP_START + 0x140, LENGTH = MBED_APP_SIZE - 0x140
m_data (RW) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
m_usb_sram (RW) : ORIGIN = 0x40100000, LENGTH = 0x00004000
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ if (!isdefinedsymbol(MBED_ROM_START)) {
define symbol MBED_ROM_START = NS_CODE_START;
}

if (!isdefinedsymbol(MBED_APP_START)) {
define symbol MBED_APP_START = MBED_ROM_START;
}

if (!isdefinedsymbol(MBED_ROM_SIZE)) {
define symbol MBED_ROM_SIZE = NS_CODE_SIZE;
}

if (!isdefinedsymbol(MBED_APP_SIZE)) {
define symbol MBED_APP_SIZE = MBED_ROM_SIZE;
}

if (!isdefinedsymbol(MBED_RAM_START)) {
define symbol MBED_RAM_START = NS_DATA_START;
}
Expand Down Expand Up @@ -72,11 +80,11 @@ if (isdefinedsymbol(__heap_size__)) {
define symbol __size_heap__ = 0x0400;
}

define symbol m_interrupts_start = MBED_ROM_START;
define symbol m_interrupts_end = (MBED_ROM_START + 0x13F);
define symbol m_interrupts_start = MBED_APP_START;
define symbol m_interrupts_end = (MBED_APP_START + 0x13F);

define symbol m_text_start = (MBED_ROM_START + 0x140);
define symbol m_text_end = (MBED_ROM_START + MBED_ROM_SIZE - 1);
define symbol m_text_start = (MBED_APP_START + 0x140);
define symbol m_text_end = (MBED_APP_START + MBED_APP_SIZE - 1);

define symbol m_interrupts_ram_start = MBED_RAM_START;
define symbol m_interrupts_ram_end = (MBED_RAM_START + __ram_vector_table_size__ - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/

#include "cmsis_nvic_virtual.h"
#include "psa/lifecycle.h"
#include "mbed_toolchain.h"

MBED_NORETURN void mbed_psa_system_reset();

void __NVIC_TFMSystemReset(void)
{
Expand Down
3 changes: 2 additions & 1 deletion targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,8 @@
"secure-ram-start": "0x30000000",
"secure-ram-size": "0x22000"
},
"OUTPUT_EXT": "hex"
"OUTPUT_EXT": "hex",
"bootloader_supported": true
},
"LPC55S69_S": {
"inherits": ["SPE_Target", "LPC55S69"],
Expand Down
2 changes: 2 additions & 0 deletions tools/psa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

def find_secure_image(notify, resources, ns_image_path, configured_s_image_filename, image_type):
""" Find secure image. """
if configured_s_image_filename is None:
return None

assert ns_image_path and configured_s_image_filename, 'ns_image_path and configured_s_image_path are mandatory'
assert image_type in [FileType.BIN, FileType.HEX], 'image_type must be of type BIN or HEX'
Expand Down
3 changes: 3 additions & 0 deletions tools/targets/LPC55S69.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@


def lpc55s69_complete(t_self, non_secure_bin, secure_bin):
if secure_bin is None:
return None

assert os.path.isfile(secure_bin)
assert os.path.isfile(non_secure_bin)

Expand Down