SoC common: optimize bl30 size - common printf [1/3]
PD#SWPL-194170
Problem:
bl30 size overflow, too much printf.
Solution:
Optimize bl30 common printf.
Verify:
t5m
Change-Id: I887ad522122e0635b24eb56bc5d6edfc02aa9f13
Signed-off-by: bangzheng.liu <bangzheng.liu@amlogic.com>
diff --git a/GCC/AML_RISC-V/aocpu/port.c b/GCC/AML_RISC-V/aocpu/port.c
index b9da957..b9946ff 100644
--- a/GCC/AML_RISC-V/aocpu/port.c
+++ b/GCC/AML_RISC-V/aocpu/port.c
@@ -153,19 +153,13 @@
}
mstatus_mps_bits = ((read_csr(mstatus) & 0x00000600) >> 9);
- printf("In trap handler, the msubmode is 0x%lx\n", read_csr_msubmode);
- printf("In trap handler, the mstatus.MPS is 0x%lx\n", mstatus_mps_bits);
- printf("In trap handler, the mcause is %lx, exception info: %s\n",
- mcause, exception_info);
- printf("In trap handler, the mepc is 0x%lx\n", read_csr(mepc));
- printf("In trap handler, the mtval is 0x%lx\n", read_csr(mbadaddr));
- if (mstatus_mps_bits == 0x1) {
- printf("The exception is happened from previous Exception mode, hence is Double-Exception-fault!\n");
- } else if (mstatus_mps_bits == 0x2){
- printf("The exception is happened from previous NMI mode!\n");
- } else if (mstatus_mps_bits == 0x3){
- printf("The exception is happened from previous IRQ mode!\n");
- }
+ printf("In trap handler\n");
+ printf("msubmode: 0x%lx\n", read_csr_msubmode);
+ printf("mstatus.MPS: 0x%lx\n", mstatus_mps_bits);
+ printf("mcause: %lx, exception info: %s\n", mcause, exception_info);
+ printf("mepc: 0x%lx\n", read_csr(mepc));
+ printf("mtval: 0x%lx\n", read_csr(mbadaddr));
+
for (i = 1; i < 31; i += 2) {
printf("x%-2d: %08x, x%-2d: %08x\n", i, *(unsigned *)(sp + i * REGBYTES),
i + 1, *(unsigned *)(sp + (i + 1) * REGBYTES));
@@ -287,21 +281,20 @@
}
/*-----------------------------------------------------------*/
-void prvTaskExitError( void )
+void prvTaskExitError(void)
{
- char *CurrentTaskName = pcTaskGetName(xTaskGetCurrentTaskHandle());
-
- printf("prvTaskExitError, current task is %s\n", CurrentTaskName);
+ printf("bl30 task %s exit error\n", pcTaskGetName(xTaskGetCurrentTaskHandle()));
/* A function that implements a task must not exit or attempt to return to
- its caller as there is nothing to return to. If a task wants to exit it
- should instead call vTaskDelete( NULL ).
- Artificially force an assert() to be triggered if configASSERT() is
- defined, then stop here so application writers can catch the error. */
- configASSERT( uxCriticalNesting == ~0UL );
+ * its caller as there is nothing to return to. If a task wants to exit it
+ * should instead call vTaskDelete(NULL).
+ * Artificially force an assert() to be triggered if configASSERT() is
+ * defined, then stop here so application writers can catch the error.
+ */
+ configASSERT(uxCriticalNesting == ~0UL);
portDISABLE_INTERRUPTS();
- printf("prvTaskExitError\n");
- for ( ;; );
+ for ( ;; )
+ ;
}
/*-----------------------------------------------------------*/
@@ -374,13 +367,9 @@
#ifdef configSOC_TIMER_AS_TICK
uint32_t threshold;
uint64_t reg;
- int ret;
/* Register SoC Timer as systick soure timer */
- ret = RegisterIrq(IRQ_NUM_TIMER, IRQ_TIMER_PROI, vPortSysTickHandler_soc);
- if (ret)
- printf("[%s]: RegisterIrq error, ret = %d\n",
- __func__, ret);
+ RegisterIrq(IRQ_NUM_TIMER, IRQ_TIMER_PROI, vPortSysTickHandler_soc);
EnableIrq(IRQ_NUM_TIMER);
/* Set timer interrupt frequency */
@@ -424,9 +413,8 @@
#ifdef CONFIG_AOCPU_BUSRESPERR_DETECTION
void vBusRespERRHandler(void)
{
- printf("bl30 bus response error: no access permission, stop here!\n");
- printf("The instruction addr is 0x%lx\n", read_csr(mepc));
- printf("The accessd addr is 0x%lx\n", read_csr(mbadaddr));
+ printf("bl30 bus resp err: access limitation, stop!\n");
+ printf("mepc: 0x%lx, mbadaddr: 0x%lx\n", read_csr(mepc), read_csr(mbadaddr));
do {} while (1);
}
#endif