SPRADG5 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 , TDA4VE-Q1 , TDA4VEN-Q1 , TDA4VH-Q1 , TDA4VL-Q1 , TDA4VM , TDA4VM-Q1 , TDA4VP-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1UART Introduction
    1. 1.1 Jacinto 7 UART Overview
    2. 1.2 Jacinto 7 UART Features
    3. 1.3 Jacinto 7 UART Functional Introduction
  5. 2UART Usage Overview
    1. 2.1 WKUP_UART0 Usage
    2. 2.2 MCU_UART0 Usage
    3. 2.3 MAIN_UARTx Usage
  6. 3Log Level Design on Software Module
  7. 4Change UART Instance
    1. 4.1 Change MAIN_UARTx for MAIN Domain
    2. 4.2 Set Standalone UART Port for DSP/MCU
  8. 5Summary
  9. 6References

MAIN_UARTx Usage

  1. The default SDK will use MAIN_UARTx to print the boot log of HLOS.
  2. For TDA4X series processors, MAIN_UARTx is used to print the APP log and the boot log of A72, R5F and DSP cores.

The software-level design of printing multi-core log to a serial port is a complex process. Understanding this multi-core log output system helps to customize the design of own system output. By default, U-BOOT and kernel will initialize a serial port for log output. For the drivers and other related information in details, see this U-BOOT/Kernel document. The control of this serial port is always on the A72 side. The log of A72 cores will be printed out directly through this serial port. However, the log of other cores is firstly put into a shared memory, and then it will be read out by the A72 application. The specific process is as follows:

  1. The OS boot of every core except A72 cores will call appInit function to initialize a 256KB shared memory shown in Figure 2-3 for storing the log.
    GUID-45C279F6-79FC-4011-99C1-72CDDD6E77F8-low.png Figure 2-3 Log Share Memory Definition on the Code
  2. This shared memory will be divided into 16 parts. Every part has 16 KB in total, and the first 32 Bytes for each part is used to store a struct shown the following code block. This struct is used to show the position of pointers in reading and writing respectively. The rest of this shared memory is used for log output.
    typedef struct {
    
     /**< Init by reader to 0 */
    
        uint32_t log_rd_idx;
    
    
    /**< Init by writer to 0 */
        uint32_t log_wr_idx;
    
    /**<  Init by writer to APP_LOG_AREA_VALID_FLAG.
     reader will ignore this CPU shared mem log
     until the writer sets this
     to APP_LOG_AREA_VALID_FLAG */ 
    
        uint32_t log_area_is_valid;
     
     /**< CPU sync state */
        uint32_t log_cpu_sync_state;   
    
    /**< Init by writer to CPU name, used by reader to add a prefix when writing to console device */
        uint8_t  log_cpu_name[APP_LOG_MAX_CPU_NAME]; 
        
        /**< memory into which logs are written by this CPU */
    
        uint8_t  log_mem[APP_LOG_PER_CPU_MEM_SIZE]; 
    } app_log_cpu_shared_mem_t;
  3. Apart from A72 cores, the log of other cores will be written to this shared memory by appLogPrintf, no matter using printf or UART_print. At the same time, the timestamp of this output log will also be written to this shared memory shown in Figure 2-4.
    GUID-2A7E4BA8-FF74-432B-A67A-3D14CB28766C-low.png Figure 2-4 MCU/DSP Core Write Log to Share Memory
  4. The A72 application vx_app_arm_remote_log.out will map this shared memory from Linux. It reads the memory every second to extract the log of each core except A72 cores, and add the name of the corresponding core and output it to the serial port shown in Figure 2-5.
    GUID-270A2A48-98CB-47D0-9989-1E8AF8D5687E-low.png Figure 2-5 A72 Core Read Log From Share Memory