Skip to content
Open
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
5 changes: 1 addition & 4 deletions os/board/bk7239n/src/components/bk_init/components_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
#include <driver/otp.h>
#endif

#if defined(CONFIG_TFM_S_TO_NS_DUMP_ENABLE)
#include "tfm_aes_gcm_nsc.h"
#endif
#include "os/mem.h"

#include "cmsis_gcc.h"
Expand Down Expand Up @@ -344,9 +342,8 @@ int components_init(void)
//wdt_init();
#endif

#if defined(CONFIG_TFM_S_TO_NS_DUMP_ENABLE) && defined(CONFIG_SECURITY_LEVEL)
extern void bk_security_to_nosecurity_dump_register_callback(void);
bk_security_to_nosecurity_dump_register_callback();
#endif
return BK_OK;
}
22 changes: 13 additions & 9 deletions os/board/bk7239n/src/middleware/arch/cm33/trap_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,6 @@ static void arch_dump_cpu_registers_securt_fault(uint32_t mcause, SAVED_CONTEXT
}
}


#if defined(CONFIG_TFM_S_TO_NS_DUMP_ENABLE) && defined(CONFIG_SECURITY_LEVEL)
//#include "tfm_aes_gcm_nsc.h"
#include <tinyara/security_level.h>
#define FRAME_BUF_LEN (64)
Expand Down Expand Up @@ -813,31 +811,38 @@ static void NS_handle_securt_fault(uint32_t reset_reason, struct tfm_exception_i

/* Handled Trap */
g_enter_exception = 1;

#ifdef CONFIG_TFM_S_TO_NS_DUMP_ENABLE
rtos_dump_system(msp, psp);


#endif
#ifdef CONFIG_SYSTEM_REBOOT_REASON
up_reboot_reason_write(BK_SECURE_FAULT_REBOOT_REASON);
bk_reboot_reset_reason();
#endif
PANIC();

while(g_enter_exception);

// rtos_enable_int(int_level);
} else {

#ifdef CONFIG_SYSTEM_REBOOT_REASON
up_reboot_reason_write(BK_SECURE_FAULT_REBOOT_REASON);
bk_reboot_reset_reason();
#endif
PANIC();
}
}

void bk_security_donmain_notifies_non_security_domain_to_dump(uint32_t *reg)
{
// High security level will not dump the exception information.
#ifdef CONFIG_SECURITY_LEVEL
if (get_security_level() > LOW_SECURITY_LEVEL) {
#ifdef CONFIG_SYSTEM_REBOOT_REASON
up_reboot_reason_write(BK_SECURE_FAULT_REBOOT_REASON);
bk_reboot_reset_reason();
#endif
PANIC();
return;
}
#endif

struct tfm_exception_info_t *ctx = &tfm_exception_info;

Expand Down Expand Up @@ -896,7 +901,6 @@ void bk_security_to_nosecurity_dump_register_callback(void)
uint32_t callback_address = (uint32_t)(&bk_security_donmain_notifies_non_security_domain_to_dump);
psa_register_dump_callback(callback_address, (uint32_t)&tfm_exception_info);
}
#endif

/* if mpu enable, accessing itcm zero pointer violates the mpu rule, please refer to mpu_cfg
* if mpu disable, null pointer/zero pointer maybe is a software fault. So bk_null_trap_handler
Expand Down