Cortex_m3_stm32 Embedded Learning Note (13): Usmart Debug Component Porting (Debug artifact)

Source: Internet
Author: User

When we learned the TFTLCD display after a very obvious problem is: parameter estimation is not accurate, for example, we want to draw a circle in the center of the screen, but often the coordinates are not allowed to lead to the MCU inside the burning process once, once a tune, but did not burn a burning can MCU life ah. Obviously this is very wasteful, so the good people think of a way (Orz), I am using the atom write Usmart component, the component porting is very simple, just need to pull the Usmart folder into the project, and then add the file to the project, there is a file Usmart_ The config.c file requires the user to add a function declaration and the required header file for the function:


First zone users add the required header files themselves

The second zone user adds the function that you want to debug, in the format

When you're done, write a main function test (code written on the basis of the previous chapter TFTLCD)

#include "led.h" #include "delay.h" #include "sys.h" #include "usart.h" #include "lcd.h" #include "usmart.h"// The LED state setting function void Led_set (U8 sta) {Led1=sta;}//Function arguments call test function void Test_fun (void (*ledset) (U8), U8 STA) {ledset (STA);}   int main (void) {   nvic_configuration ();d elay_init ();     The delay function initializes  the Uart_init (9600);//serial port is initialized to 9600led_init ();//Initialize the hardware interface with the LED connection lcd_init ();//Initialize Lcdusmart_dev.init (72); Initialize Usmart point_color=red; Lcd_clearlcd_showstring (30,50,200,16,16, "Mini STM32 ^_^"); Lcd_showstring (30,70,200,16,16, "USMART TEST"); Lcd_showstring (30,90,200,16,16, "[email protected]"); Lcd_showstring (30,110,200,16,16, "2014/3/8");     while (1) {   led0=! LED0; Delay_ms (+);}    }

Open the Serial debugging assistant, select multiple send to first introduce the list Directive,This command is used to print all Usmart callable functions


  


ID: This instruction is used to get the entry address of each function.

   Runtime instruction: for function Execution time statistics function open and Close, runtime 1 open; runtime 0 off; (default off)


For a general function call, you can fill in the parameters, such as to display "Orz" in the screen, you can send the command: lcd_showstring (20,200,200,16,16, "Orz")

The MCU will display a Orz three letters on the screen.

For a function with function arguments, the first thing to do is to find the entry address of the function parameter, through the ID instruction or, for example, we use the Led_set function as the parameter of the Test_fun, by invoking the Led_set function in the Test_fun, we implement the DS1 ( LED1) control. Locate Led_set's entry address is 0x0800022d, then send the command: Test_fun (0x0800022d,0) can see the LED1 is lit

It's about so much usage. Later to use to update

Cortex_m3_stm32 Embedded Learning Note (13): Usmart Debug Component Porting (Debug artifact)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.