zoukankan      html  css  js  c++  java
  • 基于 芯片 nordic 52832 rtt 调试(Mac 电脑)

    1.  代码配置
    2. // <e> NRF_LOG_BACKEND_SERIAL_USES_UART - If enabled data is printed over UART
      //==========================================================
      #ifndef NRF_LOG_BACKEND_SERIAL_USES_UART
      #define NRF_LOG_BACKEND_SERIAL_USES_UART 0 //选择为0
      #endif
      #if  NRF_LOG_BACKEND_SERIAL_USES_UART
      // <o> NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE  - Default Baudrate
       
      // <323584=> 1200 baud 
      // <643072=> 2400 baud 
      // <1290240=> 4800 baud 
      // <2576384=> 9600 baud 
      // <3862528=> 14400 baud 
      // <5152768=> 19200 baud 
      // <7716864=> 28800 baud 
      // <10289152=> 38400 baud 
      // <15400960=> 57600 baud 
      // <20615168=> 76800 baud 
      // <30801920=> 115200 baud 
      // <61865984=> 230400 baud 
      // <67108864=> 250000 baud 
      // <121634816=> 460800 baud 
      // <251658240=> 921600 baud 
      // <268435456=> 57600 baud 
      
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE
      #define NRF_LOG_BACKEND_SERIAL_UART_BAUDRATE 30801920
      #endif
      
      // <o> NRF_LOG_BACKEND_SERIAL_UART_TX_PIN - UART TX pin 
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_TX_PIN
      #define NRF_LOG_BACKEND_SERIAL_UART_TX_PIN 6
      #endif
      
      // <o> NRF_LOG_BACKEND_SERIAL_UART_RX_PIN - UART RX pin 
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_RX_PIN
      #define NRF_LOG_BACKEND_SERIAL_UART_RX_PIN 8
      #endif
      
      // <o> NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN - UART RTS pin 
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN
      #define NRF_LOG_BACKEND_SERIAL_UART_RTS_PIN 5
      #endif
      
      // <o> NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN - UART CTS pin 
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN
      #define NRF_LOG_BACKEND_SERIAL_UART_CTS_PIN 7
      #endif
      
      // <o> NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL  - Hardware Flow Control
       
      // <0=> Disabled 
      // <1=> Enabled 
      
      #ifndef NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL
      #define NRF_LOG_BACKEND_SERIAL_UART_FLOW_CONTROL 0
      #endif
      
      // <o> NRF_LOG_BACKEND_UART_INSTANCE  - UART instance used
       
      // <0=> 0 
      
      #ifndef NRF_LOG_BACKEND_UART_INSTANCE
      #define NRF_LOG_BACKEND_UART_INSTANCE 0
      #endif
      
      #endif //NRF_LOG_BACKEND_SERIAL_USES_UART
      // </e>
      
      // <e> NRF_LOG_BACKEND_SERIAL_USES_RTT - If enabled data is printed using RTT
      //==========================================================
      #ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT
      #define NRF_LOG_BACKEND_SERIAL_USES_RTT 1 //选择为1
      #endif
      #if  NRF_LOG_BACKEND_SERIAL_USES_RTT
      // <o> NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE - RTT output buffer size. 
      // <i> Should be equal or bigger than 
      ef NRF_LOG_BACKEND_MAX_STRING_LENGTH.
      // <i> This value is used in Segger RTT configuration to set the buffer size
      // <i> if it is bigger than default RTT buffer size.
      
      #ifndef NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE
      #define NRF_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE 512
      #endif
      
      #endif //NRF_LOG_BACKEND_SERIAL_USES_RTT
      // </e>
      
      // </h> 
      //==========================================================
      
      // </h> 
      //==========================================================
      
      // <h> nRF_Segger_RTT 
      
      //==========================================================
      // <h> segger_rtt - SEGGER RTT
      
      //==========================================================
      // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_UP - Size of upstream buffer. 
      #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
      #define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 64
      #endif
      
      // <o> SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Size of upstream buffer. 
      #ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
      #define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 2
      #endif
      
      // <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of upstream buffer. 
      #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
      #define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16
      #endif
      
      // <o> SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Size of upstream buffer. 
      #ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
      #define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
      #endif
      
      makefile 里面 增加
      CFLAGS += -DNRF_LOG_USES_RTT=1#guang add
      CFLAGS += -DNRF_LOG_USES_UART=0#guang add


      增加头文件
      #include "SEGGER_RTT.h"
      
      #define NRF_LOG_MODULE_NAME "MAIN"
      #include "nrf_log.h"
      #include "nrf_log_ctrl.h"
      测试代码如下:
         SEGGER_RTT_Init();
         SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
          uint8_t rtt=0;
          while(1){
              xd_delay_ms(1000);
              xd_uart_printf("hello
      ");
              NRF_LOG_INFO("UART Start!
      ");
               rtt++;
              SEGGER_RTT_printf(0, "%d
      
      ",rtt);
            SEGGER_RTT_WriteString(0, "###### Testing SEGGER_printf() ######
      ");        //xd_uart_printf("
      %ds
      ", i);
             SEGGER_RTT_printf(0, "%sResetting in %d second..%s
      ", RTT_CTRL_BG_BRIGHT_RED, 1, RTT_CTRL_RESET);
          }
    3. 工具查看   使用 jlinkExe 命令行来进入命令行,来进行配置连接方式,通信速率。使用jlinkRttClient来观察log。
    4. jlinkRTTClient 工具使用方法
    5. 打开JlinkRTTClient 即可打出log

  • 相关阅读:
    1.1 控制div属性
    1.7 节点进行排序显示
    [iOS问题归总]iPhone上传项目遇到的问题
    [iOS]iPhone进行真机测试(基础版)
    [iOS]利用Appicon and Launchimage Maker生成并配置iOSApp的图标和启动页
    [cocoapods]cocoapods问题解决
    [cocoapods] 如何卸载工程里的cocoapods
    [iOS]如何把App打包成ipa文件,然后App上架流程[利用Application Loader]
    [iOS]开发者证书和描述文件的作用
    [iOS]解决模拟器无法输入中文问题
  • 原文地址:https://www.cnblogs.com/jack-hzm/p/10827565.html
Copyright © 2011-2022 走看看