IAR usage notes (1)
At a.m. on October 10, August 8, the topic of the online discussion on China power grid was "the development and debugging of NXP Semiconductors Based on the lpc2000 microcontroller ". I tried to use IAR in the lab at night, but I was still unfamiliar with it. So I downloaded the PPT for this online discussion to my machine and checked it again. However, I am tired of reading the PPT. I 'd better remember the key points.
(1) Project-> creat project-> Empty Project-> Fill in the lpc21__demo (note that you do not have to write the extension as you do in some ides !)
(2) copy the three configuration files (config, startup, and zlg_src) mounted on the CD to the folder of "lpc21__demo.
(3) Right-click and add the file to the project. Add the lpc2300_cstartup.s79 under startup; add target. C, Main. C, and lpc23xx. h under the zlg_src folder to the project.
(4) Then you can modify the main. c file.
(5) Note that in config. h, there are two macros that enable IRQ: irqenable () and irqdisable ().
[Remaining questions]
In the IAR environment how to port or how to get the transplanted uC/OS-II?
In UCOS, OS _enter_critical () and OS _exit_critical () Enable IRQ interruption ().
(6) Project-> edit configuration; click New, and add "Debug in Ram" and "Debug in flash" configuration targets in the name column, you can also remove release and debug from deployments. Then OK.
(7) In the workspace drop-down list, select debug in Ram, right-click the project name maid, right-click the project name, and choose options.... The options for node "maid" dialog box is displayed.
(8) General options-> Target-> processor variant: Device: NXP lpc2378; tick off generate interwork; processor mode: arm; endian mode: Little; stack align: 4 bytes.
(9) To be continued...
Digoal, time to go to bed.
IAR usage notes (2)
(9) debugger-> setup-> DRIVER: RDI; run to main; you can also choose to run the specified configuration file (such as configuring the memmap register) before the simulation debugging ), set in "use Macao File. NOTE: If IRQ interrupt is used during debugging in Ram, you must re-map the interrupt vector! Use the "$ proj_dirs/config/Ram. Mac" configuration file. In my example, click "..." To find Ram. Mac and find it in
F:/NXP/maid/config/Ram. Mac,
Select and open it.
[Remaining questions]
What happens if IRQ is not used for debugging in Ram and I have enabled the./Ram. Mac configuration file?
(10) debugger-> download->:
Do not select use flash loader for internal RAM debugging; select it for flash debugging!
Note the different settings of DEBUG in Ram and debug in flash.
(11) RDI-> manufacturer rdi driver: C:/program files/H-JTAG v0.3.1/H-JTAG.dll. This is the drive of the H-JTAG.
(12) In order to correctly simulate debugging, you also need to configure the compilation options of the project.
Linker-> output-> Format-> tick off "allow C-spy-Specific extra output file ";
Linker-> extra output-> tick off "generate extra output file"-> Format-> simple-code!
[Remaining questions]
What's the difference between simple-code and simple?
In addition, you also need to select linker command file on the config page, that is, Address Allocation of code, variables, and stacks. Pay attention to select RAM for debugging in Ram. xcl, and select flash for debugging in flash. xcl, as follows:
Linker-> config-> tick off "override default"-> in my example, click "..." To find Ram. xcl and find it in
"F:/NXP/lpc21__demo/config/Ram. xcl", select it to open it .;
At this point, the configuration of DEBUG in Ram is complete. Then configure debug in flash. Under the debug in Flash debugging goal, many settings are consistent with in Ram, but different parts are described. The following (13) to (15) are different, which requires attention.
(13) In the workspace drop-down list, select debug in flash, right-click the project name lpc21__demo, right-click the project name, and choose
Options..., the options for node "maid" dialog box is displayed.
(14) debugger-> setup-> DRIVER: RDI; run to main; unlike the previous debug in Ram, you do not need to set use macro file here, because there is no problem with interrupt vector re ing!
Debugger-> download-> tick off "use flash loader ".
(15) In linker-> config, select linker command file, that is, Address Allocation of code, variables, and stacks.
Linker-> config-> tick off "override default"-> click "..." To find flash. xcl and find it in
"F:/NXP/lpc21__demo/config/flash. xcl", select it to open it.
IAR usage notes (3)
After the relevant parameters of the IAR environment are configured, debug the program. Compile-> make-> debug.
The following problems may occur here.
(1) path problems:
Fatal error [pe005]: cocould not open source file "../zlg_i2c/i2cint. H" F:/NXP/lpc21__demo/zlg_src/config. h 74
Add "../zlg_i2c/i2cint. H" to the project ". Copy the entire zlg_i2c directory to the project directory.
(2) Click make and the prompt is:
Error [e46]: Undefined external "irq_i2c" referred in main (F:/NXP/lpc21__demo/debug in Flash/obj/Main. r79)
Error [e46]: Undefined external "i2c_writenbyte" referred in main (F:/NXP/lpc21__demo/debug in Flash/obj/Main. r79)
Error [e46]: Undefined external "i2c_readnbyte" referred in main (F:/NXP/lpc21__demo/debug in Flash/obj/Main. r79
Er ~~ What's going on? -_-| Open the iar_for_lpc2300 routine to check whether i2cint is not added to the workspace. c. This is easy to handle. Right click-> Add group-> "i2cint"-> Add file: i2cint. c, then make again, and the messages column indicates: "Total number of errors: 0 ".
OK, have a break.