From 4927eab76e3132890b79f0ba7d6a7fde93048023 Mon Sep 17 00:00:00 2001 From: SEEKFREE_BUDING <2289331269@qq.com> Date: Fri, 16 Dec 2022 17:54:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=BA=A2=E5=87=BA=E6=96=AD=E8=A8=80=E6=8E=A5=E7=AE=A1?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E01_gpio_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E01_gpio_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E02_uart_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E02_uart_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E03_adc_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E03_adc_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E04_pwm_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E04_pwm_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E05_pit_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E05_pit_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E06_exit_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- Example/E06_exit_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../E07_encoder_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E08_eeprom_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- .../E08_eeprom_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../E09_timer_demo/libraries/zf_common/zf_common_debug.h | 8 +++++--- .../E09_timer_demo/libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- .../iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c | 7 ++++++- .../libraries/zf_common/zf_common_debug.h | 8 +++++--- .../libraries/zf_driver/zf_driver_pit.h | 4 ++-- 45 files changed, 195 insertions(+), 90 deletions(-) diff --git a/Example/E01_gpio_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E01_gpio_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E01_gpio_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E01_gpio_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E01_gpio_demo/libraries/zf_common/zf_common_debug.h b/Example/E01_gpio_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E01_gpio_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E01_gpio_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E01_gpio_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E01_gpio_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E01_gpio_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E01_gpio_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E02_uart_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E02_uart_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E02_uart_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E02_uart_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E02_uart_demo/libraries/zf_common/zf_common_debug.h b/Example/E02_uart_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E02_uart_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E02_uart_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E02_uart_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E02_uart_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E02_uart_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E02_uart_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E03_adc_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E03_adc_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E03_adc_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E03_adc_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E03_adc_demo/libraries/zf_common/zf_common_debug.h b/Example/E03_adc_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E03_adc_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E03_adc_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E03_adc_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E03_adc_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E03_adc_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E03_adc_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E04_pwm_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E04_pwm_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E04_pwm_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E04_pwm_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E04_pwm_demo/libraries/zf_common/zf_common_debug.h b/Example/E04_pwm_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E04_pwm_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E04_pwm_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E04_pwm_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E04_pwm_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E04_pwm_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E04_pwm_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E05_pit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E05_pit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E05_pit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E05_pit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E05_pit_demo/libraries/zf_common/zf_common_debug.h b/Example/E05_pit_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E05_pit_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E05_pit_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E05_pit_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E05_pit_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E05_pit_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E05_pit_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E06_exit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E06_exit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E06_exit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E06_exit_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E06_exit_demo/libraries/zf_common/zf_common_debug.h b/Example/E06_exit_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E06_exit_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E06_exit_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E06_exit_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E06_exit_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E06_exit_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E06_exit_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E07_encoder_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E07_encoder_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E07_encoder_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E07_encoder_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E07_encoder_demo/libraries/zf_common/zf_common_debug.h b/Example/E07_encoder_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E07_encoder_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E07_encoder_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E07_encoder_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E07_encoder_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E07_encoder_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E07_encoder_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E08_eeprom_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E08_eeprom_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E08_eeprom_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E08_eeprom_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E08_eeprom_demo/libraries/zf_common/zf_common_debug.h b/Example/E08_eeprom_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E08_eeprom_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E08_eeprom_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E08_eeprom_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E08_eeprom_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E08_eeprom_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E08_eeprom_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E09_timer_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E09_timer_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E09_timer_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E09_timer_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E09_timer_demo/libraries/zf_common/zf_common_debug.h b/Example/E09_timer_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E09_timer_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E09_timer_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E09_timer_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E09_timer_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E09_timer_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E09_timer_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E10_printf_debug_log_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E10_printf_debug_log_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E10_printf_debug_log_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E10_printf_debug_log_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_debug.h b/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E10_printf_debug_log_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E10_printf_debug_log_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E10_printf_debug_log_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E10_printf_debug_log_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E11_interrupt_priority_set_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E11_interrupt_priority_set_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E11_interrupt_priority_set_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E11_interrupt_priority_set_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_debug.h b/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E11_interrupt_priority_set_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E11_interrupt_priority_set_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E11_interrupt_priority_set_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E11_interrupt_priority_set_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E12_cpu1_handles_interrupts_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E12_cpu1_handles_interrupts_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E12_cpu1_handles_interrupts_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E12_cpu1_handles_interrupts_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_debug.h b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E13_dual_core_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E13_dual_core_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E13_dual_core_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E13_dual_core_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E13_dual_core_demo/libraries/zf_common/zf_common_debug.h b/Example/E13_dual_core_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E13_dual_core_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E13_dual_core_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E13_dual_core_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E13_dual_core_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E13_dual_core_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E13_dual_core_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Example/E14_specifies_variable_or_code_location_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Example/E14_specifies_variable_or_code_location_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Example/E14_specifies_variable_or_code_location_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Example/E14_specifies_variable_or_code_location_demo/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_debug.h b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_debug.h +++ b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_driver/zf_driver_pit.h b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_driver/zf_driver_pit.h +++ b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //------------------------------------------------------------------------------------------------------------------- diff --git a/Seekfree_TC264_Opensource_Library/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c b/Seekfree_TC264_Opensource_Library/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c index 0eb2e5e..02c7cb5 100644 --- a/Seekfree_TC264_Opensource_Library/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c +++ b/Seekfree_TC264_Opensource_Library/libraries/infineon_libraries/iLLD/TC26B/Tricore/Cpu/Trap/IfxCpu_Trap.c @@ -132,6 +132,7 @@ void IfxCpu_Trap_memoryManagementError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_memoryManagement, tin); IFX_CFG_CPU_TRAP_MME_HOOK(trapWatch); + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -143,6 +144,9 @@ void IfxCpu_Trap_internalProtectionError(uint32 tin) volatile IfxCpu_Trap trapWatch; trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_internalProtection, tin); IFX_CFG_CPU_TRAP_IPE_HOOK(trapWatch); + + // 如果单片机卡死在这里,则说明单片机访问到了空的内存位置,也就是常说的访问越界 + IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ __asm("rfe"); @@ -177,8 +181,9 @@ void IfxCpu_Trap_busError(uint32 tin) trapWatch = IfxCpu_Trap_extractTrapInfo(IfxCpu_Trap_Class_bus, tin); IFX_CFG_CPU_TRAP_BE_HOOK(trapWatch); - // 如果单片机卡死在了这里 说明有资源没初始化成功就直接调用了使用函数 + // 如果单片机卡死在了这里 可能是使用了未初始化的外设资源 // 举个例子,没调用pwm_init初始化函数,然后直接调用pwm_set_duty来赋值输出 + // 也可能是访问内存失败导致 如果访问失败请仔细检查使用指针访问数据的地方 IFX_CFG_CPU_TRAP_DEBUG; __asm("rslcx"); /* Restore lower context before returning. lower context was stored in the trap vector */ diff --git a/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_debug.h b/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_debug.h index 85188b9..d235093 100644 --- a/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_debug.h +++ b/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_debug.h @@ -68,11 +68,13 @@ #define zf_log(x, str) (debug_log_handler((x), (str), __FILE__, __LINE__)) // 调试信息输出 用来做一些报错或者警告之类的输出 //------------------------------------------------------------------------------------------------------------------- -// 函数简介 总线报错接管 +// 函数简介 CPU报错接管 // 返回参数 void -// 备注信息 当触发总线报错时会通过log信息输出来提醒用户 +// 备注信息 当触发CPU报错时会通过log信息输出来提醒用户 //------------------------------------------------------------------------------------------------------------------- -#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Some peripherals are not initialized"); while(1); +#define IFX_CFG_CPU_TRAP_BE_HOOK(x) zf_log(0, "Memory access failure or Use an uninitialized peripheral, please check"); while(1); +#define IFX_CFG_CPU_TRAP_IPE_HOOK(x) zf_log(0, "Accessing an null address, array access may be out of bounds, please check"); while(1); + typedef struct { diff --git a/Seekfree_TC264_Opensource_Library/libraries/zf_driver/zf_driver_pit.h b/Seekfree_TC264_Opensource_Library/libraries/zf_driver/zf_driver_pit.h index 88c1cfb..664fabd 100644 --- a/Seekfree_TC264_Opensource_Library/libraries/zf_driver/zf_driver_pit.h +++ b/Seekfree_TC264_Opensource_Library/libraries/zf_driver/zf_driver_pit.h @@ -62,7 +62,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_ms初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:ms) +// 参数说明 time 周期时间(单位:毫秒) // 返回参数 void // 使用示例 pit_ms_init(CCU60_CH0, 5); // 设置周期中断5ms //------------------------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ void pit_init (pit_index_enum pit_index, uint32 time); //------------------------------------------------------------------------------------------------------------------- // 函数简介 pit_us初始化 // 参数说明 pit_index 选择CCU6模块 -// 参数说明 time 周期时间(单位:毫秒) +// 参数说明 time 周期时间(单位:微秒) // 返回参数 void // 使用示例 pit_us_init(CCU60_CH0, 5); // 设置周期中断5us //-------------------------------------------------------------------------------------------------------------------