ZHCADN6 January 2024 AM67 , AM67A , AM68 , AM68A , AM69 , AM69A , DRA821U , DRA821U-Q1 , DRA829J , DRA829J-Q1 , DRA829V , DRA829V-Q1 , TDA4AEN-Q1 , TDA4AH-Q1 , TDA4AL-Q1 , TDA4AP-Q1 , TDA4APE-Q1 , TDA4VE-Q1 , TDA4VEN-Q1 , TDA4VH-Q1 , TDA4VL-Q1 , TDA4VM , TDA4VM-Q1 , TDA4VP-Q1 , TDA4VPE-Q1
默認(rèn)情況下,J7 SOC 的 MCU 和 DSP 內(nèi)核不會為串行端口輸出設(shè)置單獨的 UART。對于 TDA4X,默認(rèn)情況下,除 A72 內(nèi)核之外的每個內(nèi)核的日志都將寫入一個共享存儲器,然后 A72 應(yīng)用程序會讀取這些日志并將其打印到 MAIN_UARTX 串行端口。但是,為了方便調(diào)試,通常有必要同時打印多個內(nèi)核的日志,或者在內(nèi)核 A 不能正常工作時繼續(xù)打印日志。在這種情況下,需要為 MCU/DSP 內(nèi)核配置一個單獨的串行端口。下面以 TDA4VM 為例為 C7 設(shè)置單獨的串行端口。
diff --git a/vision_apps/platform/j721e/rtos/c7x_1/main.c
b/vision_apps/platform/j721e/rtos/c7x_1/main.c
index 0dcfa4fd..e857838b 100755
--- a/vision_apps/platform/j721e/rtos/c7x_1/main.c
+++ b/vision_apps/platform/j721e/rtos/c7x_1/main.c
@@ -88,7 +88,8 @@
#include <ti/sysbios/family/c7x/Hwi.h>
#include <ti/sysbios/family/c7x/Mmu.h>
#endif
+#include <ti/drv/uart/UART.h>
+#include <ti/drv/uart/UART_stdio.h>
/* For J7ES/J721E/TDA4VM the upper 2GB DDR starts from 0x0008_8000_0000 */
/* This address is mapped to a virtual address of 0x0001_0000_0000 */
#define DDR_C7X_1_LOCAL_HEAP_VADDR (DDR_C7X_1_LOCAL_HEAP_ADDR)
@@ -96,18 +97,33 @@
+extern int uart_print_test(void);
+extern int uart_test(void);
@@ -181,9 +197,13 @@ int main(void)
{
TaskP_Params tskParams;
TaskP_Handle task;
OS_init();
+/* Set TDA4VM PINMUX UART2_RX(PIN Y1)&UART2_TX(PIN Y5)
+* We can get the register address from the datasheet
+*/
+ *((int *)(0x00011C1DC))=0x50003;
+ *((int *)(0x00011C1E0))=0x10003;
+ uart_print_test();
appC7xClecInitDru();
在路徑 vision_apps/basic_demos/ 下創(chuàng)建 c7_uart_print 臨時文件夾,并創(chuàng)建 c7_uart_print.c 和 concerto .mk 文件作為初始配置 UART 庫。
以下內(nèi)容針對 c7_uart_print.c。
#include <ti/drv/uart/UART.h>
#include <ti/drv/uart/UART_stdio.h>
#include <ti/board/src/j721e_evm/include/board_utils.h>
#include <ti/board/board.h>
#include <ti/board/src/j721e_evm/include/board_cfg.h>
int uart_test(void)
{
UART_printf("\n=============================================\n");
UART_printf("\n**********c7x uart printf********************\n");
UART_printf("* UART Test *\n");
UART_printf("*********************************************\n");
return 0;
}
int uart_print_test(void)
{
Board_initParams_t initParams;
/* Verify the SoC UART0 */
Board_getInitParams(&initParams);
initParams.uartInst = 2;
initParams.uartSocDomain = BOARD_SOC_DOMAIN_MAIN;
Board_setInitParams(&initParams);
Board_init(BOARD_INIT_UART_STDIO);
uart_test();
return 0;
}
以下內(nèi)容針對 concerto.mk。
ifeq ($(TARGET_CPU),$(filter $(TARGET_CPU), x86_64 C71 C7120))
include $(PRELUDE)
TARGET := c7_uart_print
TARGETTYPE := library
CSOURCES := $(call all-c-files)
CPPSOURCES := $(call all-cpp-files)
CFLAGS+= -mv7100 --c11
ifeq ($(TARGET_CPU), x86_64)
IDIRS += $(CGT7X_ROOT)/host_emulation/include/C7100
CFLAGS += --std=c++14 -D_HOST_EMULATION -pedantic -fPIC -w -c -g -o4
CFLAGS += -Wno-sign-compare
endif
include $(FINALE)
endif
diff --git a/vision_apps/utils/console_io/src/app_log_writer.c b/vision_apps/utils/console_io/src/app_log_writer.c
index a02a785c..561d1434 100755
--- a/vision_apps/utils/console_io/src/app_log_writer.c
+++ b/vision_apps/utils/console_io/src/app_log_writer.c
@@ -220,6 +220,32 @@ int32_t appLogWrPutString(app_log_wr_obj_t *obj)
return status;
}
+#if defined C71
+int32_t c7x_appLogWrPutString(app_log_wr_obj_t *obj)
+{
+ int32_t status = 0;
+ volatile uint32_t copy_bytes,num_bytes;
+ volatile uint8_t *buf = (uint8_t*)obj->buf;
+
+
+ if (0 == status)
+ {
+ num_bytes = strlen((char*)buf);
+
+ if (num_bytes <= 0)
+ {
+ status = -1;
+ }
+ }
+
+ if (0 == status)
+ {
+ UART_puts(buf,num_bytes);
+ }
+
+ return status;
+}
+#endif
void appLogPrintf(const char *format, ...)
{
@@ -266,6 +292,8 @@ void appLogPrintf(const char *format, ...)
printf(obj->buf);
#endif
}
+ #elif defined C71
+ c7x_appLogWrPutString(obj);
#else
appLogWrPutString(obj);
#endif
diff --git a/vision_apps/platform/j721e/rtos/concerto_c7x_inc.mak b/vision_apps/platform/j721e/rtos/concerto_c7x_inc.mak
index 4e3c5a29..4a9c94db 100755
--- a/vision_apps/platform/j721e/rtos/concerto_c7x_inc.mak
+++ b/vision_apps/platform/j721e/rtos/concerto_c7x_inc.mak
@@ -19,6 +19,10 @@ endif
ifeq ($(RTOS),SAFERTOS)
LDIRS += $(PDK_PATH)/packages/ti/osal/lib/safertos/$(SOC)/c7x/$(TARGET_BUILD)/
endif
+
+LDIRS += $(PDK_PATH)/packages/ti/drv/uart/lib/$(SOC)/c7x/$(TARGET_BUILD)/
+LDIRS += $(PDK_PATH)/packages/ti/drv/i2c/lib/$(SOC)/c7x/$(TARGET_BUILD)/
+LDIRS += $(PDK_PATH)/packages/ti/board/lib/$(SOC)_evm/c7x/$(TARGET_BUILD)/
LDIRS += $(PDK_PATH)/packages/ti/csl/lib/$(SOC)/c7x/$(TARGET_BUILD)/
LDIRS += $(PDK_PATH)/packages/ti/drv/ipc/lib/$(SOC)/c7x_1/$(TARGET_BUILD)/
LDIRS += $(PDK_PATH)/packages/ti/drv/udma/lib/$(SOC)/c7x_1/$(TARGET_BUILD)/
@@ -45,6 +49,7 @@ STATIC_LIBS += vx_app_ptk_demo_common
STATIC_LIBS += vx_kernels_common
STATIC_LIBS += vx_target_kernels_img_proc_c71
STATIC_LIBS += vx_app_c7x_voxel2point
+STATIC_LIBS += c7_uart_print
PTK_LIBS =
PTK_LIBS += ptk_algos
@@ -76,6 +81,9 @@ ADDITIONAL_STATIC_LIBS += ipc.ae71
ADDITIONAL_STATIC_LIBS += dmautils.ae71
ADDITIONAL_STATIC_LIBS += sciclient.ae71
ADDITIONAL_STATIC_LIBS += udma.ae71
+ADDITIONAL_STATIC_LIBS += ti.drv.uart.ae71
+ADDITIONAL_STATIC_LIBS += ti.board.ae71
+ADDITIONAL_STATIC_LIBS += ti.drv.i2c.ae71
ifeq ($(RTOS),FREERTOS)
ADDITIONAL_STATIC_LIBS += ti.kernel.freertos.ae71
上面介紹了 SDK 級別的所有更改。只需要執(zhí)行下一步操作即可重新編譯 C7 固件并將其刷寫到 SD 卡或 EMMC 中。