使用 Trace32 对 FLASH 编程
trace32的使用培训
trace32的使⽤培训TRACE32 Online HelpTRACE32 DirectoryTRACE32 IndexTRACE32 Documents ......................................................................................................................! ICD In-Circuit Debugger ................................................................................................................! ICD Quick Installation and Tutorial ...........................................................................................! ICD Tutorial (1)Tutorial (3)About the Tutorial3 Start TRACE32-ICD4 Setup the Application Properties6 The Online Help7 Setup the Debug Environment10 Batch Jobs13 The User Interface15 How to Display and Modify CPU Registers18 How to Display and Modify the Special Function Registers20 How to Display and Modify Memory21 How to Debug the Program25 How to Set Breakpoints34 Software Breakpoints34 Breakpoints in ROM, Flash, EEPROM38 Breakpoints on Data Accesses39 Onchip Breakpoints (Overview)41 Display and Modify HLL Variables43 Format HLL-Variables45 Exit TRACE3248Version July, 26 2004TutorialAbout the TutorialWhat is it about?This is a tutorial for all In-Circuit Debuggers (TRACE32-ICD), that are implemented using their onchip debug interface. T ypical examples for onchip debug interfaces are BDM, JT AG, ONCE …Preconditions:The tutorial assumes that the development system is already installed. Y ou should have basic knowledge of the C-programming language in order to be able to follow the example code found in this tutorial. In addition working with WINDOWS is assumed as known. Also some knowledge of the used processor andassembler/compiler is necessary to get your debug system running.Purpose of this tutorial:The purpose of this tutorial is to get your debug system running, to write the batch job that does the necessary startup procedure and to make you familiar with the main features of the In-Circuit Debugger.How to use this tutorial:The tutorial contains a guided debug session. It uses a simple C-program example to show you the most important debug features. Y ou should perform a number of exercises as you read this tutorial. Werecommend to go completely through all chapters, since besides the tour (written in normal text format) there are very helpful remarks (written in italics) which will not be repeated in other chapters.Where can I get more information:The common TRACE32 user interface contains a detailed Online-Help, that offers the most currentdescription of all debug features. Refer to The Online Help on how to start the Online Help system.How long does it take?60 minutes.Start TRACE32-ICDIf your debug tools are installed in accordance to Quick Installation for TRACE32-ICD, power up your debug system first and then the target.T o start the debugger software on your host open the TRACE32 folder in the start menu and start theTRACE32 user interface. If you have generated an icon on your desktop, double click there. In the example below the software for two processor families (PowerPC and 68HC12) is installed.Setup the Application PropertiesThe property window of your application allows some basic settings for the debugger.1.Definition of a user specific configuration file.By default the configuration file config.t32 in the system directory is used. The option -c allowsyou to define your own location and name for the configuration file. For more information on theconfiguration file refer to Quick Installation forTRACE32-ICD2. Definition of a working directory.It is recommended not to work in the system directory.3. Definition of the start-up size of the application window.123The Online HelpThe most current version of the TRACE32 books is available in the online help. Y ou can get access to the TRACE32 online help using:the Help Topics button in the toolbarthe Help Contents entry in the menu barenter “HELP” in the command linetoolbar command linehelp menuThe online help provides also a powerful context sensitive help .Click first on the Help Context button and then move the quotation mark cursor on the object you are interested in. A popup window is opened to display information about this object.Use the Help Context button on the tool barto activate the context sensitive helpThe About TRACE32… command in the Help menu provides version information for all parts of TRACE32-ICD.Setup the Debug EnvironmentIn order to set-up your debugger, you need some knowledge about your CPU and about your target configuration. T o be able to download your program including all symbol and debug information you also need some knowledge about your compiler.A basic start-up procedure and the CPU specific setting for the ICD-Debuggers are described in the ICD Target Manual .Look at the Reference ICE/FIRE/ICD book for a detailed description of all generic commands.A typical start-up procedure consists of:ICD Target Manual gives quick accessto the settings and additional features for your CPU1.The CPU specific settings.The SYStem Window provides all CPU specific settings. Use System Settings… in the CPU menu to open this window.Inform the debugger about the CPU type on your target, if an automatic detection of the CPU is not possible. Select the correct CPU type from the pull down menu in the field CPU.(Command: SYStem.CPU )Set the system options in the option field corresponding to your target configuration and application program. (Command: SYStem.OptionOn some processor types the special function registers can be moved. The command(SYStem.Option BASE) is used to inform the debugger about the new base address (address of the first SFR). If the debugger does not have the correct base address no or wrong data will bedisplayed and FLASH programming might not be possible.Set the transfer clock from the debug interface to your target. By default TRACE32-ICD uses a fixed clock, generated by the Debug Module, to run the debug interface. A clock range from 100KHz up to5 MHz can be used.(Command: SYStem.BdmClock)We also provide a clock cable to allow you the use of the divided CPU clock as clock for the debug interface. The relation between the CPU clock and the debug interface clock is specific for your CPU.Refer to your ICD Target Manual for detailed information. The use of the divided CPU clock has the following advantages: The max. speed for the debug interface can be used. However we recommend 10MHz as the max.speed.The clock for the debug interface is automatically adapted if the CPU clock is changed by your appli-cation program.2. Enter the debug mode.Select the Up button in the Mode field to restart the CPU with debug mode enable.(Command: SYStem.Up)The user interface establishes the communication to the target′s microprocessor. After this command you should be able to access the registers.3. Do the target specific settings.The CPU is active now and you can initialize the CPU by writing to the special function registers using the Data.Set command. E. g. some CPUs need to set the chip selects in order to access memory. 4. Load your application.Load your application by using the commandData.LOAD.The option required for your compiler can be found in the ICD Target Manual in the sectionCompiler.If the file should be loaded to an EEPROM, the memory class EEPROM must be used to generate the required programming sequence. Example: d.load.b epromdata EEPROM:For flash programming refer to the FLASH command group in the Reference ICE/FIRE/ICD book.T o display the source code the compiled program must be equipped with debug information(frequently: compiler option “debug”). Then TRACE32 can load the compiler output formats directly.5. Initialize program counter and stackpointer: Register.SetMany compilers add these settings in the startup code to the user program automatically.It is recommended to write a batch job to set up the debugger to guarantee a proper start-up sequence.Batch JobsCreate a new batch file start.cmm in your working directory by using the command PEDIT start.cmm.TRACE32 has its own command language for batch jobs. It is called PRACTICE and it is very powerful (see the PRACTICE User’s Guide and PRACTICE Reference for more information). All commands of the TRACE32 development tools, commands for program flow, conditional commands and I/O commands are allowed. The default extension for batch files is “.cmm”.Also debugging of a PRACTICE program is supported. Look at the description in the PRACTICE User’s Guide and PRACTICE Reference (commands: PLIST, PEDIT, PBREAK).Enter the required commands, finish the batchjob by ENDDO and click the Save button. The picture above shows a startup procedure for the PowerPC505.Start the startup procedure by using Batchfile… in the File pulldown menu.T o continue our tour take one of the example files you can find in the TRACE32 system directory under \demo\\compiler\...e.g. \demo\powerpc\compiler\Diab\Diabc.cmm.or use your own batch file, if you have already prepared one.The User InterfaceRegister ButtonPulldown MenuCommand LineOpen a window to display the CPU registers. Y ou can alternatively select Registers from the View pulldown menu, push the Register button or enter Register.view at the prompt B:: in the command line.Most features can alternatively be selected from a pulldown menu, from a button in the main tool bar or from the command line. Please remember this even if we use just one way in the following chapters.The TRACE32 commands are not case sensitive. In the TRACE32 books we use upper case letters for the characters that are significant for the command entry. E.g. Register.view can be shortened by r . Another example which shows the typical TRACE32 command structure. is Data.List that can be shortened to d.l .A good hint is to look at the soft keys. They provide a guided command entry . All possible commands and parameters are displayed. Instead of writing to the command line you can assemble the correct command by clicking on the soft keys. Example: Assembly of the Data dump command by using the softkeys.More detailed information about the TRACE32 user interface can be found in the Operating System User’s Guide .In the window header the TRACE32 command that was executed to open the window is displayed.Soft KeysHow to Display and Modify CPU RegistersWe want to inspect the CPU registers now.T ry to change a register value by double-clicking on the value you want to change. The Register.Set command for the selected register is displayed in the command line. Y ou only have to enter the new value and confirm it with return (see right picture above).If the registers changed by the last steps should be marked in the Register window:1.Click to the window header with the right mouse button.The command, that was used to open the window is displayed in the command line for modification.The window header becomes red.2. Set the option /SpotLight and confirm the modification with return.3. Execute a few single steps.The registers changed by the last step are marked in dark red. The registers changed by the step before the last step are marked a little bit lighter etc. This works up to a level of 4 steps.function registers:If you select the register contents the address, bit position and complete name of the special function register is displayed in the state line.Y ou can modify the contents of a special function register:By pressing the right mouse button and selecting one of the predefined logical values from the pull-down menu.By a double-click to numeric values. A Data.Set command to change the register contents is dis-played in the command line. Enter the new value and confirm it with return.How to Display and Modify MemoryT o inspect an address range in the memory use the Data.dump window.。
TRACE32的一些常用命令
TRACE32的⼀些常⽤命令TRACE32的⼀些常⽤命令我们使⽤Trace32最主要⽤途有两个:程序下载和程序调试。
下载⽬前各个项⽬都有相应的.cmm⽂件(类似于批处理⽂件.bat),在此⽂件中,Trace32把对FLASH擦除/编程的插件下载到⼿机的SRAM中,然后把控制权交给此插件,详细过程就不在此叙述,这⾥主要是介绍⼀些我们在程序调试过程中常⽤的⼀些命令。
1.把调试⽤的.elf⽂件下载到⽬标板中命令:d.load.elf *.elf 或者直接输⼊elf⽂件路径:d.load.elf d:\p200\surfcr.elf说明:此命令把.elf⽂件中的调试符号信息下载到Trace32中,⼆进制代码下载到⽬标板中的代码段存储区域。
如果代码段对应的存储体是SRAM,那么代码能够真实的下载到SRAM中(最常见的就是EVB板条死)。
如果存储体是FLASH,由于FLASH程序的擦写需要特殊的命令序列,所以执⾏完下载命令后,虽然Trace32没有报错,但实际上代码没有下载进去。
这个时候需要⽤cmm⽂件把代码下载到FLASH中去。
2.elf⽂件下载进去后,在调试之前还需要做⼀些准备⼯作a.map.bonchip 0x0—0x3ffff(FLASH的地址范围)如果程序下载到SRAM中,此命令不⽤执⾏,如果是FLASH,⼀般情况下都需要执⾏此条命令,否则⽆法设置断点,⽬前⼤多数CPU在ICD调试模式下只⽀持两个硬件断点。
b.y.spath + 路径(eg: y.spath d:\z2100\qct)⽀持所加路径的C源码以及汇编代码显⽰。
3.以上⼯作做完后,就可以利⽤Trace32强⼤的调试功能来调试程序了(可惜到现在我们只是⽤到了其中的⼀部分)。
a.查看ARM寄存器。
⼀般使⽤在调试/查看汇编代码的情况下使⽤。
b.查看存储器单元以及存储器映射的寄存器内容。
注意:MSM5105的寄存器具有只读和只写属性(SoftWare Interface中有描述),对于只写属性的寄存器,虽然能够看到寄存器的内容,但不可信。
trace32仿真器使用教程+
简介大家可能会对uTrace-ICD比较陌生,简单介绍一下,uTrace-ICD 是TRACE32-ICD的兼容机。
在这里我首先感谢国人的努力能让我用很少的RMB用上这么高端仿真器。
废话少说,下面我给大家介绍一下uTrace-ICD下具体实现Linux调试的具体过程。
大概介绍一下实现的具体原理,首先要有一块可用的目标板,我选用的是SMDK2410评估板。
编译环境是在虚拟VMware+RedHat9.0,调试环境是uTRACE。
在这里有个问题:就是在虚拟机下编译的arm linux内核如何传递给安装在Windows下的uTRACE。
我用的方法就是通过SMB服务器。
在Redhat9.0下配置SMB Server将arm linux的源码包通过网络共享的方式共享给Windows XP。
在XP下的Windows 资源管理器中将Redhat9.0共享的arm linux源码包影射为本地的一个虚拟盘比如是:Z盘。
这样uTRACE就可以象操作本地盘一样来读取Redhat9.0中的arm linux源码包以及编译生成的内核映像及内核的符号表。
对于uTRACE调试器来说,需要的东东就是包含调试信息的arm linux的内核映像vmlinux。
在这里要注意"包含调试信息",arm linux内核配置选项默认可能是不包含调试信息,如果将没有包含调试信息的vmlinux供uTRACE使用是实现不了内核源码级调试的。
所以我们在配置arm linux内核时一定要将包含内核调试信息的选项选上。
具在"kernel hacking"下。
其次uTRACE调试器需要的就是arm linux内核源码树。
调试器的工作原理就是通过给定的地址查找对应的符号表找到对应的符号,以及符号所在文件的路径信息,行信息等,近而找到源程序所对应的函数或变量。
简单介绍了uTRACE调试的基本原理,接下来,具体介绍一下arm linux内核,驱动,及应用层源码级调试的具体实现过程。
关于TRACE32使用说明
目录1.系统组成1.1硬件1.1.1主机1.1.2调试电缆1.1.3通过USB与PC连接1.1.4通过JTAG与目标连接1.1.5对PC硬件的要求1.1.6对目标板硬件的要求1.1.7加电1.2软件1.2.1驱动程序的安装2.PowerView调试界面的使用3.1 打开调试界面3.2 JTAG连接设置3.3 运行脚本文件3.4 观察/修改寄存器3.5 观察/修改存储器3.6 下载程序3.7 观察符号表3.8 打开程序列表窗口3.9 单步执行程序3.10 设置软件断点3.11 设置Onchip硬件断点3.12 设置数据观察断点3.13 全速运行程序3.14 停止运行程序3.15 观察变量3.16 观察堆栈3.17 在线Flash编程1.系统组成TRACE-ICP调试系统由硬件和软件两部分组成,硬件是自行研发的,软件是第三方的。
下面分成硬件和软件两部分来介绍。
1.1硬件TRACE-ICP的硬件设计采用模块化的结构,分为主机和调试电缆两部分。
1.1.1主机下面三张照片是TRACE-ICP主机的顶视图和前视图以及后视图。
图一、TRACE-ICP顶视图图二、TRACE-ICP前视图图三、TRACE-ICP后视图在图二中的连接器是标准DB25/M连接器,用于连接调试电缆。
在图三中,有两个连接器和一个LED指示灯。
左边的连接器是USB接口,用于通过USB电缆和PC连接。
右边的连接器是TRACE-ICP的外接5VDC电源接口。
TRACE-ICP可以通过USB供电,在USB供电不足的情况下,使用外接电源。
LED指示灯是TRACE-ICP的电源指示灯。
1.1.2调试电缆下图是TRACE-ICP的调试电缆的照片。
图四、TRACE-ICP的调试电缆TRACE-ICP的调试电缆有两个连接端,一个是标准的DB25/F连接器,用于和TRACE-ICP主机相连,另一个是针距为2.54毫米的标准IDC20连接器,用于和目标板连接。
stm32f4 flash读写例程
一、概述STM32F4是ST公司推出的一款高性能的32位微控制器,它具有强大的性能和丰富的外设资源,广泛应用于工业控制、消费电子、通信设备等领域。
其中,STM32F4的Flash存储器模块具有较大的存储容量和快速的读写速度,非常适合用来存储程序代码和数据。
本文将介绍如何使用STM32F4的Flash存储器模块进行读写操作的例程。
二、开发环境准备1. 基本硬件准备:准备一块STM32F4开发板,如STM32F407ZGT6开发板。
一台电脑,安装了Keil或者其他的开发环境。
2. 软件准备:在电脑上安装好STM32CubeMX和Keil或者其他的开发环境。
三、创建工程1. 打开STM32CubeMX,新建一个工程,选择对应的芯片型号,例如选择STM32F407ZGT6。
2. 配置时钟树,使得系统时钟为想要的频率,一般选择高频率以获得更快的Flash读写速度。
3. 配置Flash存储器,选择合适的扇区大小和擦写次数。
4. 生成代码,导出工程。
四、编写代码1. 在Keil或者其他的开发环境中打开刚刚生成的工程。
2. 找到Flash读写相关的API,一般在芯片提供的库函数中可以找到。
3. 根据需要编写Flash读写的代码,例如可以编写一个函数来实现向Flash写入数据的功能。
五、编译下载1. 编译代码,生成bin文件。
2. 将bin文件下载到STM32F4开发板中,可以使用ST-Link或者其他下载工具来完成。
六、调试运行1. 确保下载成功,重启开发板。
2. 进行调试,观察Flash读写是否正常。
七、注意事项1. 在进行Flash写入操作时,一定要小心谨慎,避免对程序的正常运行造成影响。
2. 在进行Flash擦除操作时,务必注意擦除的范围,避免擦除了不该擦除的数据。
3. 在进行Flash读写操作时,需要留意Flash的特性和限制,以免造成不必要的麻烦。
八、总结本文介绍了如何在STM32F4开发板上使用Flash存储器进行读写操作的例程,从开发环境准备到代码编写再到调试运行都有详细的步骤说明,并给出了注意事项和总结。
Lauterbach黑芯调试器TRACE32在线帮助说明书
Blackfin Debugger Release 09.2023Blackfin DebuggerTRACE32 Online HelpTRACE32 DirectoryTRACE32 IndexTRACE32 Documents ......................................................................................................................ICD In-Circuit Debugger ................................................................................................................Processor Architecture Manuals ..............................................................................................Blackfin ....................................................................................................................................Blackfin Debugger (1)Introduction (4)Brief Overview of Documents for New Users4 Demo and Start-up Scripts5 Location of Debug Connector5Warning (5)Quick Start JTAG (6)Troubleshooting (8)SYStem.Up Errors8FAQ (8)Configuration (9)System Overview9Blackfin specific SYStem Commands (10)SYStem.CONFIG Configure debugger according to target topology10 Daisy-Chain Example13 TapStates14 SYStem.CONFIG.CORE Assign core to TRACE32 instance15 SYStem.CPU CPU type selection16 SYStem.JtagClock JTAG clock selection17 SYStem.LOCK Lock and tristate the debug port17 SYStem.MemAccess Real-time memory access (non-intrusive)18 SYStem.Mode System mode selection19 SYStem.Option.IMASKASM Interrupt disable19 SYStem.Option.IMASKHLL Interrupt disable20Breakpoints (21)Software Breakpoints21 On-chip Breakpoints21 Breakpoint in ROM21Example for Breakpoints22 Memory Classes (23)CPU specific TrOnchip Commands (24)JTAG Connector (25)Blackfin DebuggerVersion 10-Oct-2023 IntroductionThis document describes the processor specific settings and features for the Blackfin Embedded Media Processor. TRACE32-ICD supports all Blackfin devices which are equipped with the JT AG debug interface.Please keep in mind that only the Processor Architecture Manual (the document you are reading at the moment) is CPU specific, while all other parts of the online help are generic for all CPUs supported by Lauterbach. So if there are questions related to the CPU, the Processor Architecture Manual should be your first choice.If some of the described functions, options, signals or connections in this Processor Architecture Manual are only valid for a single CPU the name is added in brackets.Brief Overview of Documents for New UsersArchitecture-independent information:•“Training Basic Debugging” (training_debugger.pdf): Get familiar with the basic features of a TRACE32 debugger.•“T32Start” (app_t32start.pdf): T32Start assists you in starting TRACE32 PowerView instances for different configurations of the debugger. T32Start is only available for Windows.•“General Commands” (general_ref_<x>.pdf): Alphabetic list of debug commands.Architecture-specific information:•“Processor Architecture Manuals”: These manuals describe commands that are specific for the processor architecture supported by your Debug Cable. T o access the manual for your processorarchitecture, proceed as follows:-Choose Help menu > Processor Architecture Manual.•“OS Awareness Manuals” (rtos_<os>.pdf): TRACE32 PowerView can be extended for operating system-aware debugging. The appropriate OS Awareness manual informs you how to enable theOS-aware debugging.Demo and Start-up ScriptsLauterbach provides ready-to-run start-up scripts for known Blackfin based hardware.To search for PRACTICE scripts, do one of the following in TRACE32 PowerView:•Type at the command line: WELCOME.SCRIPTS•or choose File menu > Search for Script.Y ou can now search the demo folder and its subdirectories for PRACTICE start-up scripts(*.cmm) and other demo software.Y ou can also manually navigate in the ~~/demo/blackfin/ subfolder of the system directory ofTRACE32.Location of Debug ConnectorLocate the debug connector on your target board as close as possible to the processor to minimize the capacitive influence of the trace length and cross coupling of noise onto the JT AG signals. WarningSignal LevelThe debugger output voltage follows the target voltage level. It supports a voltage range of 0.4…5.2V. ESD ProtectionNOTE:T o prevent debugger and target from damage it is recommended to connect ordisconnect the debug cable only while the target power is OFF.Recommendation for the software start:•Disconnect the debug cable from the target while the target power is off.•Connect the host system, the TRACE32 hardware and the debug cable.•Start the TRACE32 software.•Connect the debug cable to the target.•Switch the target power ON.Power down:•Switch off the target power.•Disconnect the debug cable from the target.Quick Start JTAGStarting up the debugger is done as follows:1.Select the device prompt B: for the ICD Debugger, if the device prompt is not active after the TRACE32 software was started.2.Select the CPU type to load the CPU specific settings.3.Enter debug mode:This command resets the CPU and enters debug mode. After the execution of this command access to the registers and to memory is possible. Before performing the first access to external SDRAM or FLASH the External Bus Interface Unit (EBIU) must be configured.4.The following command sequence is for the BF537 processor and configures the SDRAM controller with default values that were derived for maximum flexibility. They work for a system clock frequency between 54MHz and 133MHz.In the example a ST M29W320DB flash device is used in 16-bit mode. All four memory banks and CLKOUT are enabled.B:SYStem.CPU BF537SYStem.Up; configure SDRAM controllerData.Set 0xFFC00A1sLONG 0x0091998D Data.Set 0xFFC00A14 %WORD 0x0025Data.Set 0xFFC00A1C %WORD 0x03A0; EBIU_SDGCTL ; EBIU_SDBCTL ; EBIU_SDRRC; enable all flash memory banks and clock outData.Set 0xFFC00A00 %WORD 0x00FF; EBIU_AMGCTL; ST M29W320DB flash device in 16-bit modeFLASH.Create 1. 0x20000000--0x20003FFF 0x4000 AM29LV100 Word FLASH.Create 1. 0x20004000--0x20007FFF 0x2000 AM29LV100 Word FLASH.Create 1. 0x20008000--0x2000FFFF 0x8000 AM29LV100 Word FLASH.Create 1. 0x20010000--0x203FFFFF 0x10000 AM29LV100 Word5.Load the program.Data.LOAD.Elf demo.dxe; The file demo.dxe is in ELF format The option of the Data.LOAD command depends on the file format generated by the compiler. A detailed description of the Data.LOAD command is given in the “General Commands Reference”. The start-up sequence can be automated using the programming language PRACTICE. A typical start sequence is shown below. This sequence can be written to a PRACTICE script file (*.cmm, ASCII format) and executed with the command DO<file>.B::; Select the ICD device promptWinClear; Delete all windowsSYStem.CPU BF537; select the processorSYStem.Up; Reset the target and enter debug modeData.Load.Elf sieve.dxe; Load the applicationRegister.Set PC main; Set the PC to function mainList.Mix; Open disassembly window *) Register.view; Open register window *) PER.view; Open window with peripheral register *) Break.Set sieve; Set breakpoint to function sieveBreak.Set 0x1000 /p; Set on-chip breakpoint to address 1000; Refer to the restrictions in; On-chip Breakpoints.*) These commands open windows on the screen. The window position can be specified with the WinPOS command.TroubleshootingSYStem.Up ErrorsThe SYStem.Up command is the first command of a debug session where communication with the target is required. If you receive error messages while executing this command this may have the following reasons.All The target has no power.All There are additional loads or capacities on the JTAG lines.All The JTAG clock is too fast.FAQPlease refer to https:///kb.Configuration System OverviewBlackfin specific SYStem CommandsSYStem.CONFIG Configure debugger according to target topologyThe four parameters IRPRE, IRPOST , DRPRE, DRPOST are required to inform the debugger about the T AP controller position in the JT AG chain, if there is more than one core in the JT AG chain (e.g. ARM + DSP). The information is required before the debugger can be activated e.g. by a SYStem.Up . See Daisy-chain Example .For some CPU selections (SYStem.CPU ) the above setting might be automatically included, since the required system configuration of these CPUs is known.T riState has to be used if several debuggers (“via separate cables”) are connected to a common JT AG port at the same time in order to ensure that always only one debugger drives the signal lines. T APState and TCKLevel define the T AP state and TCK level which is selected when the debugger switches to tristate mode. Please note: nTRST must have a pull-up resistor on the target, TCK can have a pull-up or pull-down resistor, other trigger inputs need to be kept in inactive state.Format:SYStem.CONFIG <parameter> <number_or_address>SYStem.MultiCore <parameter> <number_or_address> (deprecated)<parameter>:CORE <core><parameter>:(JTAG):DRPRE <bits>DRPOST <bits>IRPRE <bits>IRPOST <bits>DAPDRPOST <bits>DAPDRPRE <bits>DAPIRPOST <bits>DAPIRPRE <bits>TAPState <state>TCKLevel <level>TriState [ON | OFF ]Slave [ON | OFF ]DEBUGPORTTYPE [JTAG | SWD ]SWDPIDLEHIGH [ON | OFF ]SWDPTargetSel <value>CORE For multicore debugging one TRACE32 PowerView GUI has to be startedper core. To bundle several cores in one processor as required by thesystem this command has to be used to define core and processorcoordinates within the system topology.Further information can be found in SYStem.CONFIG.CORE.… DRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TDI signal and the TAP you are describing. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… DRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TAP you are describing and the TDO signal. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… IRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JT AG chain between TDI signal andthe TAP you are describing. See possible T AP types and example below.Default: 0.… IRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JTAG chain between the T AP you aredescribing and the TDO signal. See possible TAP types and examplebelow.Default: 0.TAPState(default: 7 = Select-DR-Scan) This is the state of the TAP controller whenthe debugger switches to tristate mode. All states of the JTAG T APcontroller are selectable.TCKLevel (default: 0) Level of TCK signal when all debuggers are tristated. TriState(default: OFF) If several debuggers share the same debug port, thisoption is required. The debugger switches to tristate mode after eachdebug port access. Then other debuggers can access the port. JT AG:This option must be used, if the JTAG line of multiple debug boxes areconnected by a JTAG joiner adapter to access a single JTAG chain. Slave(default: OFF) If more than one debugger share the same debug port, allexcept one must have this option active.JTAG: Only one debugger - the “master” - is allowed to control the signalsnTRST and nSRST (nRESET).DEBUGPORTTYPE [JTAG | SWD]It specifies the used debug port type “JT AG”, “SWD”. It assumes the selected type is supported by the target.Default: JT AG.SWDPIdleHigh [ON | OFF]Keep SWDIO line high when idle. Only for Serialwire Debug mode. Usually the debugger will pull the SWDIO data line low, when no operation is in progress, so while the clock on the SWCLK line is stopped (kept low).Y ou can configure the debugger to pull the SWDIO data linehigh, when no operation is in progress by usingSYStem.CONFIG SWDPIdleHigh ONDefault: OFF.SWDPTargetSel<value>Device address in case of a multidrop serial wire debug port.Default: none set (any address accepted).Daisy-Chain ExampleBelow, configuration for core C.Instruction register length of •Core A: 3 bit •Core B: 5 bit •Core D: 6 bitSYStem.CONFIG.IRPRE 6.; IR Core D SYStem.CONFIG.IRPOST 8.; IR Core A + B SYStem.CONFIG.DRPRE 1.; DR Core D SYStem.CONFIG.DRPOST 2.; DR Core A + BSYStem.CONFIG.CORE 0. 1.; Target Core C is Core 0 in Chip 1Core A Core B Core CCore D TDOTDI Chip 0Chip 1TapStates0Exit2-DR1Exit1-DR2Shift-DR3Pause-DR4Select-IR-Scan5Update-DR6Capture-DR7Select-DR-Scan8Exit2-IR9Exit1-IR10Shift-IR11Pause-IR12Run-Test/Idle13Update-IR14Capture-IR15Test-Logic-ResetSYStem.CONFIG.CORE Assign core to TRACE32 instance Format:SYStem.CONFIG.CORE<core_index><chip_index>SYStem.MultiCore.CORE<core_index><chip_index> (deprecated) <chip_index>:1 (i)<core_index>:1…kDefault core_index: depends on the CPU, usually 1. for generic chipsDefault chip_index: derived from CORE= parameter of the configuration file (config.t32). The COREparameter is defined according to the start order of the GUI in T32Start with ascending values.T o provide proper interaction between different parts of the debugger, the systems topology must bemapped to the debugger’s topology model. The debugger model abstracts chips and sub cores of these chips. Every GUI must be connect to one unused core entry in the debugger topology model. Once the SYStem.CPU is selected, a generic chip or non-generic chip is created at the default chip_index.Non-generic ChipsNon-generic chips have a fixed number of sub cores, each with a fixed CPU type.Initially, all GUIs are configured with different chip_index values. Therefore, you have to assign thecore_index and the chip_index for every core. Usually, the debugger does not need further information to access cores in non-generic chips, once the setup is correct.Generic ChipsGeneric chips can accommodate an arbitrary amount of sub-cores. The debugger still needs information how to connect to the individual cores e.g. by setting the JT AG chain coordinates.Start-up ProcessThe debug system must not have an invalid state where a GUI is connected to a wrong core type of a non-generic chip, two GUIs are connected to the same coordinate or a GUI is not connected to a core. The initial state of the system is valid since every new GUI uses a new chip_index according to its CORE= parameter of the configuration file (config.t32). If the system contains fewer chips than initially assumed, the chips must be merged by calling SYStem.CONFIG.CORE.SYStem.CPU CPU type selection Format:SYStem.CPU <cpu><cpu>:BF531 | BF532 | BF533 | BF534…Default selection: BF534.Selects the CPU type.SYStem.JtagClock JT AG clock selection Format:SYStem.JtagClock [<frequency>]SYStem.BdmClock<frequency>(deprecated)Default frequency: 1MHz.Selects the JT AG port frequency (TCK). Any frequency up to 50MHz can be entered, it will be generated by the debuggers internal PLL.For CPUs which come up with very low clock speeds it might be necessary to slow down the JT AGfrequency. After initialization of the CPUs PLL the JT AG clock can be increased.SYStem.LOCK Lock and tristate the debug port Format:SYStem.LOCK [ON | OFF]Default: OFF.If the system is locked, no access to the debug port will be performed by the debugger. While locked, the debug connector of the debugger is tristated. The main intention of the SYStem.LOCK command is to give debug access to another tool.SYStem.MemAccess Real-time memory access (non-intrusive) Format:SYStem.MemAccess Denied | StopAndGo | BTCBTC“BTC” allows a non-intrusive memory access while the core is running, if aBackground T elemetry Channel (BTC) is defined in your application. Anyinformation on how to create such a channel can be found in AnalogDevices’ VisualDSP++ user’s manual. The JT AG clock speed should be asfast as possible to get good performanceDenied Real-time memory access during program execution to target is disabled.StopAndGo Temporarily halts the core(s) to perform the memory access. Each stoptakes some time depending on the speed of the JT AG port, the number ofthe assigned cores, and the operations that should be performed.SYStem.Mode System mode selectionFormat:SYStem.Mode <mode>SYStem.Attach (alias for SYStem.Mode Attach)SYStem.Down (alias for SYStem.Mode Down)SYStem.Up (alias for SYStem.Mode Up)<mode>:DownGoAttachUpDown Disables the debugger.Go Resets the target with debug mode enabled and prepares the CPU fordebug mode entry. After this command the CPU is in the system.upmode and running. Now, the processor can be stopped with the breakcommand or if a break condition occurs.Attach User program remains running (no reset) and the debug interface isinitialized.Up Resets the target and sets the CPU to debug mode. After execution ofthis command the CPU is stopped and prepared for debugging.StandBy Not supported.NoDebug Not supported.SYStem.Option.IMASKASM Interrupt disable Format:SYStem.Option.IMASKASM [ON | OFF]Mask interrupts during assembler single steps. Useful to prevent interrupt disturbance during assembler single stepping.SYStem.Option.IMASKHLL Interrupt disable Format:SYStem.Option.IMASKHLL [ON | OFF]Mask interrupts during HLL single steps. Useful to prevent interrupt disturbance during HLL single stepping.BreakpointsThere are two types of breakpoints available: software breakpoints and on-chip breakpoints. Software BreakpointsSoftware breakpoints are the default breakpoints. A special breakcode is patched to memory so it only can be used in RAM or FLASH areas.There is no restriction in the number of software breakpoints.On-chip BreakpointsThe Blackfin processor has a total of six instruction and two data on-chip breakpoints.A pair of two breakpoints may be further grouped together to form a range breakpoint. A range breakpointcan be including or excluding. In the first case the core is stopped if an address in the range is detected, in the second case the core is stopped when an address outside of the range is observed.Breakpoint in ROMWith the command MAP.BOnchip<range> it is possible to inform the debugger about ROM(FLASH,EPROM) address ranges in target. If a breakpoint is set within the specified address range the debugger uses automatically the available on-chip breakpoints.Example for BreakpointsAssume you have a target with FLASH from 0x20000000 to 0x200FFFFF and RAM from 0x0 to 0x1000000. The command to configure TRACE32 correctly for this configuration is: Map.BOnchip 0x20000000--0x200FFFFFThe following breakpoint combinations are possible.Software breakpoints:Break.Set 0x0 /Program; Software Breakpoint 1Break.Set 0x1000 /Program; Software Breakpoint 2On-chip breakpoints:Break.Set 0x20000100 /Program; On-chip Breakpoint 1Break.Set 0x2000ff00 /Program; On-chip Breakpoint 2Memory ClassesThe following memory classes are available: Memory Class DescriptionP ProgramD DataCPU specific TrOnchip CommandsThe TrOnchip command group is not available for the Blackfin debugger.JTAG ConnectorSignal Pin Pin SignalGND12EMU-N/C34GNDVDDIO56TMSN/C78TCKN/C910TRST-N/C1112TDIGND1314TDOJTAG Connector Signal Description CPU Signal TMS JTAG-TMS,TMSoutput of debuggerTDI TDI JTAG-TDI,output of debuggerTCK TCK JTAG-TCK,output of debugger/TRST /TRST JTAG-TRST,output of debuggerTDO TDO JTAG-TDO,input for debugger/EMU JTAG Emulation Flag /EMUVDDIO VDDIO This pin is used by the debugger to sense the targetI/O voltage and to set the drive levels accordingly. Ifthe sensed voltage level is too low (e.g. target has nopower) the debugger powers down its drivers toprevent the target from damage.。
TRACE32 调试器使用指南 TRACE32 Trace Tutorial说明书
T race T utorial Release 02.2023TRACE32 Online HelpTRACE32 DirectoryTRACE32 IndexTRACE32 Debugger Getting Started ..............................................................................................Trace Tutorial (1)History (3)About the Tutorial (3)What is Trace? (3)Trace Use Cases4Trace Methods (5)Simulator Demo (6)Trace Configuration (7)Trace Recording (8)Displaying the Trace Results (10)Trace List10 Displaying Function Run-Times13 Graphical Charts13 Numerical Statistics and Function Tree14 Duration Analysis15 Distance Analysis16 Variable Display17 Track Option18Searching Trace Results (19)Trace Save and Load (20)Version 10-Feb-2023 History18-Jun-21New manual.About the TutorialThis tutorial is an introduction to the trace functionality in TRACE32. It shows how to perform a tracerecording and how to display the recorded trace information.For simplicity, we use in this tutorial a TRACE32 Instruction Set Simulator, which offers a full tracesimulation. The steps and features described in this document are however valid for all TRACE32 products with trace support.The tutorial assumes that the TRACE32 software is already installed. Please refer to “TRACE32Installation Guide” (installation.pdf) for information about the installation process.Please refer to “ICD Tutorial” (icd_tutorial.pdf) for an introduction to debugging in TRACE32 PowerView. What is Trace?T race is the continuous recording of runtime information for later analysis. In this tutorial, we use the term trace synonymously with core trace. A core trace generates information about program execution on a core,i.e. program flow and data trace. The TRACE32 Instruction Set Simulator used in this tutorial supports a fulltrace simulation including the full program flow as well as all read and write data accesses to the memory. A real core may not support all types of trace information. Please refer to your Processor Architecture Manual for more information.Trace Use CasesT race is mainly used in the following cases:1.Understand the program execution in detail in order to find complex runtime errors more quickly.2.Analysis of the code performance of the target code3.Verification of real-time requirements4.Code-coverage measurementsTrace MethodsTRACE32 supports various trace methods. The trace method can be selected in the Trace configuration window, which can be opened from the menu Trace > Configuration…If a trace method is not supported by the current hardware/software setup, it is greyed out in the trace configuration window. NONE means that no trace method is selected.We use in this tutorial the trace method Analyzer. Please refer to the description of the commandTrace.METHOD for more information about the different trace methods.Simulator DemoWe use in this tutorial a TRACE32 Simulator for Arm. The described steps are however valid for the TRACE32 Simulator for other core architectures.T o load a demo on the simulator, follow these steps:1.Start the script search dialog from the menu File > Search for scripts…2.Enter in the search field “compiler demo”3.Select a demo from the list with a double click, a PSTEP window will appear. Press the“Continue” button.We will use here the demo “GNU C Example for SRAM”.Trace ConfigurationIn order to set up the trace, follow these steps:1.Open the menu Trace > Configuration… The trace method Analyzer [A] should be selected perdefault. If this is not the case, select this trace method2.Clear the contents of the trace buffer by pressing the Init button [B].3.Select the trace operation mode [C].In mode Fifo , new trace records will overwrite older records. The trace buffer includes thus always the last trace cycles before stopping the recording.In Mode Stack , the recording is stopped if the trace buffer is full. The trace buffer always includes in this case the first cycles after starting the recording.Mode Leash is similar to mode Stack , the program execution is however stopped when the trace buffer is nearly full.TRACE32 supports other trace modes. Some of these modes depend on the core architecture. Please refer to the documentation of the command Trace.Mode for more information. We will keep here the default trace mode selection, which is Fifo .4.The SIZE field [D] indicates the size of the trace buffer. As we are using a TRACE32 Simulator, the trace buffer is reserved by the TRACE32 PowerView application on the host. It is thuspossible to increase the size of this buffer. If a TRACE32 trace hardware is used with a real chip, the size of the trace buffer is limited by the size of the memory available on the trace tool.In order to have a longer trace recording, we will set the trace buffer size to 10000000.BACDThe same configuration steps can be performed using the following PRACTICE script:Trace RecordingPress the Go button to start the program execution.The trace recording is automatically started with the program execution. The state in the Trace window changes from OFF to Arm [A]. The used field displays the fill state of the trace buffer [B].In order to stop the trace recording, stop the program execution with the Break button. The state in the trace window changes to OFF .Trace.METHOD Analyzer Trace.InitTrace.Mode FifoTrace.SIZE 10000000.BACThe trace recording is automatically started and stopped when starting and stopping the program execution because of the AutoArm[C] setting in the Trace window, which is per default enabled. The trace recording can also be started/stopped manually while the program execution is running using the radio buttons Armand OFF of the Trace window [A].Displaying the Trace ResultsTRACE32 offers different view for displaying the trace results. This document shows some examples.Please note that the trace results can only be displayed if the trace state in the Trace window is OFF. It is not possible to display the trace results while recording.The caption of a TRACE32 window includes the TRACE32 command that can be executed in the TRACE32 command line or in a PRACTICE script to open this window, e.g. here Trace.ListTrace ListA list view of the trace results can be opened from the menu T race > List > Default. The same window canbe opened from the Trace configuration window by pressing the List button.The Trace.List window displays the recorded trace packets together with the corresponding assembler and source code.In our case, trace packets are program fetches (cycle fetch) or data accesses (e.g. wr-long and rd-long for 32bit write and read accesses). Each trace packet has a record number displayed in the record column. The record number is a negative index for Fifo mode.As we are using a Simulator, each assembly instruction has an own trace packet. This is not the case with a real hardware trace.The displayed information can be reduced using the Less button. By pressing Less three times, only the high-level source code is displayed. This can be reverted using the More button.A double click on a line with an assembly instruction or high-level source code opens a List window showing the corresponding line in the code.Using the TRACE32 menu Trace > List > Tracing with Source , you get a Trace.List and a List /Track window. When doing a simple click on a line in the Trace.List window, the List window will automaticallydisplay the corresponding code line.The timing information (see ti.back column) is generated in this case by the TRACE32 Instruction Set Simulator. With a real core trace, timestamps are either generated by the TRACE32 trace hardware or by the onchip trace module.Double clickSimpleclickDisplaying Function Run-TimesTRACE32 supports nested and flat function run-time analysis based on the trace results. Please refer to the video “Flat vs. Nesting Function Runtime Analysis” for an introduction to function run-time analysis inTRACE32:/tut_profiling.htmlGraphical ChartsBy selecting the menu Trace > Chart > Symbols, you can get a graphical chart that shows the distribution of program execution time at different symbols. The displayed results are based on a flat analysis:The corresponding nesting analysis can be displayed using the menu Perf > Function Runtime > Show as Timing.The In and Out buttons can be used to zoom in/out. Alternatively, you can select a position in the window and then use the mouse wheel to zoom in/out.Numerical Statistics and Function TreeThe menu entry Perf > Function Runtime >Show Numerical displays numerical statistics for each function with various information as total run-time, minimum, maximum and average run-times, ratio, and number of function calls.ABParents [A] displays for example a caller tree for the selected function. By doing a right mouse click on func1 and selecting Parents, we see the run-times of the functions func2 and func9, which have called func1 in thetrace recording.Children [B] displays the run-times of the functions called by the selected function, for example here the function subst called by the function encode.A function call tree view of all function recorded in the trace can be displayed using the menu entries Perf >Function Runtime > Show as Tree or Perf > Function Runtime > Show Detailed Tree.Duration AnalysisBy doing a right mouse click on a function in the numerical statistics window (Trace.STATistic.Func) then selecting Duration Analysis, you get an analysis of the function run-times between function entry and exit including the time spent in called subroutines, e.g. here for the function subst (P:0x114C corresponds to the start address of the subst function):The time interval can be changed using the Zoom buttons.Distance AnalysisBy doing a right mouse click on a function in the numerical statistics window (Trace.STATistic.Func) then selecting Distance Analysis, you can get run-times between two consecutive calls of the selected function,e.g. here for the function subst (P:0x114C corresponds to the start address of the subst function):Variable DisplayThe Trace.ListVar command allows to list recorded variables in the trace. If the command is used without parameters all recorded variables are displayed:Y ou can optionally add one or multiple variables as parameters.Example: display all accesses to the variables plot1 and plot2The Draw button can then be used to plot the displayed variables graphically against time. This corresponds to the following TRACE32 command:Please refer for more information about the Trace.DRAW command to “Application Note forTrace.DRAW” (app_trace_draw.pdf).Trace.ListVar Trace.ListVar %DEFault plot1 plot2Trace.DRAW.Var %DEFault plot1 plot2Track OptionThe /Track options allows to track windows that display the trace results. Y ou just need to add the /Track option after the command that opens a trace window, e.g.Trace.List /TrackThe cursor will then follow the movement in other trace windows, e.g. Trace.Chart.Func. Default is time tracking. If no time information is available, tracking to record number is performed.TRACE32 windows that displays the trace results graphically, e.g. Trace.Chart.Func, additionally accept the /ZoomTrack option. If the tracking is performed with another graphical window, the same zoom factor is used in this case.Trace.Chart.Func /ZoomTrackSearching Trace ResultsThe Find button allows to search for specific information in the trace results.Example 1: find the first call of function func21.Enter “func2” under address / expression2.Select Program under cycle3.Press the Find First button. The next entries to func2 in the trace can then be found using theNext buttonExample 2: Find all write accesses to the variable mstatic1 with the value 0x01.Enter “mstatic1” under address / expression2.Select Write under cycle3.Enter 0x0 under Data4.Press the Find All buttonPlease refer to “Application Note for Trace.Find” (app_trace_find.pdf) for more information about Trace.Find.Trace Save and LoadThe recorded trace can be stored in a file using the command Trace.SAVE , e.g.The saved file can then be loaded in TRACE32 PowerView using the command Trace.LOADThe TRACE32 trace display windows will show in this case a LOAD message in the low left cornerPlease note that TRACE32 additionally allows to export/import the trace results in different formats. Refer to the documentation of the command groups Trace.EXPORT and Trace.IMPORT for more information. Trace.SAVE file.adTrace.LOAD file.ad。
关于STM32的FLASH操作
关于STM32的FLASH操作STM32是一款由意法半导体(STMicroelectronics)推出的32位精简型单片机系列。
它采用了ARM Cortex-M内核,并在Flash和内存等方面进行了优化,提供了强大的性能和丰富的外设功能。
FLASH是STM32芯片上的一种非易失性存储器,可以用于存储应用程序代码、数据、配置信息等。
在STM32中进行FLASH操作可以通过编程和标准库函数两种方式实现。
下面将依次介绍这两种方法的使用。
一、编程方式编程方式是直接对FLASH进行底层的读写操作,需要对相关寄存器进行配置和控制。
1.写入数据在STM32的FLASH中写入数据的操作需要经历以下步骤:1) 解锁FLASH:通过FLASH_Unlock(函数解锁FLASH,使其可写入。
2) 擦除FLASH:通过FLASH_ErasePage(函数擦除要写入的FLASH扇区。
3) 写入数据:通过FLASH_ProgramByte(、FLASH_ProgramHalfWord(、FLASH_ProgramWord(等函数对FLASH进行数据写入。
4) 上锁FLASH:通过FLASH_Lock(函数上锁FLASH,防止误操作。
以下是一个简单的例子,演示如何通过编程方式对STM32的FLASH进行数据写入:```c#include "stm32f10x_flash.h"void ConfigureFlash(void)FLASH_Unlock(; // 解锁FlashFLASH_ClearFlag(FLASH_FLAG_EOP , FLASH_FLAG_PGERR ,FLASH_FLAG_WRPRTERR); // 清除状态标志FLASH_ErasePage(FLASH_START_ADDR); // 擦除扇区FLASH_Lock(; // 上锁Flash```2.读取数据读取STM32的FLASH数据需要通过指针的方式直接读取存储器的地址,如下所示:```c#define READ_FLASH(addr) (*(volatile uint32_t*)(addr))void ReadFlash(void)uint32_t data = READ_FLASH(FLASH_START_ADDR);//在这里对读取的数据进行处理```二、标准库函数方式STM32提供了一套标准库函数,方便开发者进行FLASH操作。
05-Trace32 发挥你最大工作效率
2013‐3‐25
Lauterbach China
19
Board Bring‐up ‐‐ PD
基态内存分配 集成外部触发信号 基于Debugger的系统分析 调试结果文档化
2013‐3‐25
Lauterbach China
20
System Integration & OS ‐ PD
IDE/Prototypes
API
VAST for PPC, ARM, StarCore, OAK, TeakLite, V850
Virtio for ARM
TI Simulator for C55x, C54x, C6200, C6400, C6700
GDI for TriCore
MDI for MIPS, ZSP
‐TRACE32® ‐
发挥最大的工作效率
Frank, Xing
2013‐3‐25
Lauterbach China
Байду номын сангаас
1
‐TRACE32® ‐
¾产业背景 Lauterbach 公司简介 产品简介及其特点 培训及服务
Frank, Xing
2013‐3‐25
Lauterbach China
2
产业背景
1. Simulink 2. Rhapsody 3. Eclipse 4. …
2013‐3‐25
Lauterbach China
22
Quality & Testing – PT II
基于跟踪数据的调试
2013‐3‐25
Lauterbach China
23
Quality & Testing – PT II
Trace32-ICD使用说明
Trace32-ICD使用说明作者:***日期:2008-8-11版本:V-1.0一、编写目的通过对该文档的阅读,能够掌握Trace32-ICD的软、硬件安装,使用Trace32-ICD进行flash擦除,程序下载,并熟悉在线调试。
二、T RACE32硬件的连接Trace32的硬件连接如下图所示:图2.1注意事项:电源打开/关闭时的正确顺序:打开:先调试器,再目标机。
关闭:先目标机,再调试器。
三、TRACE32软件的安装3.1 TRACE32-ICD软件包安装1、首先获取安装软件包,包括:Trace32安装包和USB Driver。
2、安装Trace软件包,运行..\ trace32\setup.bat批处理文件或..\trace32\bin\setup\setup.exe文件,系统自动安装,在安装过程中进行如下选择。
图 3.1 图3.2图3.3其他选项基本默认。
3.2 USB驱动安装正确连接Trace后,系统会自动提示发现硬件需要进行驱动。
此时选择驱动程序所在目录。
路径为..\ trace32\bin。
如图3.4所示。
图3.4四、Flash的擦除与下载程序由于手机在下载版本过程中死机或掉电造成手机无法正常启动,并且使用我们单位的ZXPST与QPST都无法进行版本下载,并且QXDM和ZXPST通过COM1接口也无法找到手机,于是无法下载。
在这种情况下我们可以使用Trace32-ICD进行Flash的擦除和程序下载。
4.1 设置环境CPU环境设置在SYStem窗口,SYStem窗口提供所有CPU特定的设置。
使用CPU菜单中的System Settings…打开SYStem窗口如图4.1所示。
需要配置主要包括CPU、时钟和UP加电,CPU选择ARM926EJ,时钟JtagClock选择Ttck,然后进行加电UP,如果连接一切都正常,设置这几项就可以了。
如图4.1所示:图4.1注意事项:如果UP不上出现如下错误emulation debug port fail,说明硬件连接不正确。
基于TRACE32仿真器对CPU模块的一种调试方法
基于TRACE32仿真器对CPU模块的一种调试方法作者:孙锴王鹏来源:《数字技术与应用》2018年第01期摘要:本文介绍了一种CPU电路板,调试的时候发现该模块无法正常启动,于是使用TRACE32仿真器进行调试排故,非常具有代表性。
关键词:CPU;MPC8245;TRACE32;SDRAM;FLASH中图分类号:TP33 文献标识码:A 文章编号:1007-9416(2018)01-0109-01TRACE32是由德国Lauterbach公司研制开发的一款仿真测试工具。
TRACE32作为一种真正集成化、通用性系统仿真器可以组合成多种方案,可以支持网络方案、实验室单机方案、异地光纤方案等,它具有全模块化、积木式结构、可支持JTAG及BDM接口和所有CPU,能够提供软件分析、端口分析、波形分析以及软件测试等强大功能。
本文介绍在CPU电路板上,使用TRACE32仿真器进行排故的一种方法。
1 电路组成电路组成如图1所示,主要由CPU、SDRAM、FLASH、逻辑电路等组成。
1.1 处理器采用Freescale公司MPC8245高性能、低功耗处理器,该处理器集成了MPC603e内核及PCI桥,存储器控制器,DMA控制器,可编程中断控制器,I2C控制器。
支持浮点运算,存储器管理,16K字节命令cache,16K字节数据cache,电源管理等[1]。
在本设计中CPU采用MPC8245TZU300D,TBGA封装,核心频率最高可达300MHz,核心电压为1.9V~2.1V,IO电压为3.0V~3.6V,工作温度-40℃~+105℃,典型功耗2.2W。
本设计中,MPC8245核心频率设计为266MHz,约505.4MIPS,能够满足用户不低于500MIPS的要求。
1.2 SDRAM在本设计中,SDRAM用于存放用户的数据和代码,为程序的运行和保存临时文件提供空间。
MPC8245提供了高速的SDRAM控制器,数据宽度配置为64位。
NANDFLASH产生DUMP过程
NAND FLASH产生DUMP的过程1. 通过TRACE32或者OPENICE全擦除镜像(用erasenand.cmm)。
2. 通过TRACE32或者OPENICE烧入所有的生成镜像文件BOOT及AMSS(用mjnand.cmm)。
3. 通过QPST的DOWNLOAD工具将QCN文件下载入手机。
4. 使用AMS工具PRI/Default NV/AudioNV等EFS相关的数据下载到手机中。
注:PRI/Default NV/AudioNV 这些都是服务器上稳定版本对应的5. 相关工具环境的配制:A.当在系统中安装完Perl 5.6.1 and Perl TK后,需要在PC机的环镜变量中加入以下:PERL5.6.1=C:\Perl\bin (check installation directory on your computer)JTAG_TOOL=T32B.在Trace32 的配制文件config.t32 的尾部加上以下配制项:RCL=NETASSISTPACKLEN=1024PORT=200006. QFIT的启动和配制:A. To start QFIT:a. Open the DOS command window.b. Go to the AMSS_build_directory\tools\qfitc. Type Qfit.cmd and press ENTER.B.Configure QFITAs follows:a. Select 2048-byte Page Flash if the Flash device used has 2k page flash.b. Select the MJNAND DIRECTORY pull-down menu if the directory shown is incorrect.–mjnandc. Select the CUSTOMER FILE pull-down menu if the customer file you are usingis incorrect. –custnayaz.hd. Select the SELECT MSM pull-down menu to select the MSM™ ASIC. –Q6055e. Select the BUILD CODE pull-down menu if the build code shown is incorrect.注:做a-e 之后可以点Update QFITconfig2 然后Exit,再打开QFIT,TAB选项就和下图一样了。
TRACE32系列仿真器介绍教程文件
RTXC
pSOS
– ...
深圳旋极
TRACE32为何与众不同
五、FLASH,可擦写。全序列,任选择。
TRACE32支持FLASH在线编程,FLASH(厂家) 主要有:
AMD ATMEL MICRON
MOTOROLA
FUJISTU INTEL MITSUBISHI
MACRONIX
SHARP SST ST
TI
TOSHIBA…
既支持片外FLASH,也支持片内FLASH 支持8bit、16bit、32bit总线宽度
深圳旋极
TRACE32为何与众不同
六、测软件,辨好坏。查性能,算覆盖。
TRACE32具有独特的嵌入式软件测试功能: – 程序追踪(Trace)
程序流程 选择追踪... – 函数性能测试(Performance)
仿真控制模块Emulation Controller 系统控制模块System Controller
深圳旋极
TRACE32-ICE配置方案举例
例1:简洁型,针对8位单片机
ICExxx ECC8 SCU32
深圳旋极
TRACE32-ICE配置方案举例
例2:简洁型,针对32位单片机
ICExxx ECC32 SCU32
Zilog
Infineon ...
通用性,更换仿真模块就可调试不同的芯片
深圳旋极
TRACE32为何与众不同
三、编译器,款款宜。各平台,没问题。
TRACE32支持60种以上的编译器,主要有:
ARM Borland Tasking CAD-UL Diab-SDS
Greenhills
Hitech Hiware HP
运行时间 函数嵌套... – 代码覆盖分析(Coverage)
Jlink在MDK下使用J-link_J-trace 模式开发STM32的说明
Jlink V7在MDK下使用J-link/J-trace 模式开发STM32的说明说句实话,STM32的官方程序库用起来真是有点麻烦,绕来绕去的,初学者很容易犯迷糊。
求人不如靠自己啊,经过一晚上的摸索,终于自己在MDK开发环境下建立了自己的工程,走马灯也跑起来了,呵呵呵....开发环境:STM32F103RB(128K Flash 20K RAM)+MDK3.40PRC+JLINK V70.驱动安装安装Segger jlink V4.02驱动,安装在c:\Program Files\SEGGER\JLinkARM_V402插上jlink V7,可自动安装上驱动。
执行J-link command,查看版本。
如果已经连上目标板,可显示目标处理器信息。
也可以使用mdk中的驱动,在c:\keil\ARM\Segger\USBdriver1.建立MDK工程(1)选择STM32F103RB 并加入STARTUP文件,这一步就不用细说了吧,用过keil的人都会。
(2)工程中选择Options for target ‘xxx’,选择器件STM32F103RB(3) 配置Jlink:按照下图配置即可时钟改成1MHz以上,也是可以的,比如2MHz,明显编程速度会快些。
需要试验最高时钟速率。
这样,一个可以用Jlink调试的MDK工程就建立好了,接下来我们加入我们的C文件就可以开始调试了。
2 编写程序C文件源码如下:#define GPIOC_CRL (*((unsigned int *)(0x40011000)))#define GPIOC_BSRR (*((unsigned int *)(0x40011010)))#define GPIOC_BRR (*((unsigned int *)(0x40011014)))#define RCC_APB2ENR (*((unsigned int *)(0x40021018)))void delay(void){unsigned int i;for(i = 0; i < 0xffff; ++i);}int main(void){{RCC_APB2ENR |=(1<<2); //使能PORTA时钟GPIOA_CRL = 0x44444422;//PA0,1配置为输出while(1){GPIOA_BSRR |= BIT0;GPIOA_BRR |= BIT0;delay();GPIOA_BRR |= BIT0;GPIOA_BSRR |= BIT1;delay();}}如此,一个简单的走马灯程序就完成了,比起官方库,容易理解多了,呵呵。
STM32在SRAM、FLASH中调试代码的配置方法
STM32在SRAM、FLASH中调试代码的配置方法STM32的FLASH擦写次数有限(大概为1万次),所以为了延长FLASH的使用时间,我们平时调试时可以选择在SRAM中进行硬件调试。
除此之外,SRAM 存储器的写入速度比在内部FLASH 中要快得多,所以下载程序到SRAM中的速度较快。
所以我们很有必要建立两个版本的工程配置,在SRAM中调试程序完毕后,再把代码下载到FLASH中即可。
这篇笔记主要分享在keil5中配置FLASH调试与SRAM调试的详细配置方法及如何切换两种配置。
本篇笔记以STM32F103ZET6为例。
其FLASH大小为512KB,SRAM的大小为64KB。
FLASH基地址为0x08000000,SRAM基地址为0x20000000。
在STM32F10XXX 里,可以通过BOOT1、BOOT0引脚来选择三种不同的模式:我们要在FLASH中进行硬件仿真调试还是在RAM中进行硬件仿真调试需要对这两个boot脚进行对应的设置以及程序下载的地址进行设置。
在F L A S H中进行硬件仿真调试1、硬件设置BOOT0配置为0,BOOT1随意设置。
2、keil设置本文以keil5为例。
步骤如下:(1)点击如下按钮,修改target的名称:target的名称是可以随意更改的,这里我们改为FLASH。
(2)点击Project->Options for Target Flash...(也可以点击魔术棒那个图标)进行配置。
首先对Target选项卡设置:设置IROM1的起始地址为0x8000000,大小为0x80000,即FLASH的基地址与大小。
设置IRAM1为0x20000000,大小为0x10000,即SRAM的基地址与大小。
(3)Debug选项设置:调试器根据实际进行选择,我们这里使用的调试器是ULINK2。
其它的按默认设置即可,然后点击Settings:(4)编译,然后按Ctrl+F5进入调试界面:然后点击全速运行:在Disassembly窗口中可看到地址为0x0800xxxx,说明代码烧进了FLASH中,这时候就可以像使用其他C语言IDE调试C语言程序一样打断点、单步运行我们的STM32程序啦。
STM32内部FLASH读写操作详解(附代码)
(2)擦除将要写的页STM32 的 FLASH 在编程的时候,也必须要求其写⼊地址的 FLASH 是被擦除了的(也就是其值必须是 0XFFFF),否则⽆法写⼊,在 FLASH_SR 寄存器的 PGERR 位将得到⼀个警告。
STM32 的闪存擦除分为两种:页擦除和整⽚擦除。
也就是其最⼩擦除单位为1页,尽管你只需往某页⾥写10个字节数据或者更少的数据,你也必须先擦除该页(2*1024个字节)。
我们这⾥使⽤按页擦除,固件库中按页擦除的函数为:左右滑动查看全部代码>>>/* 按页擦除 */FLASH_Status FLASH_ErasePage(uint32_t Page_Address);其返回值为枚举:左右滑动查看全部代码>>>typedef enum{ FLASH_BUSY = 1, /* 忙 */ FLASH_ERROR_PG, /* 编程错误 */FLASH_ERROR_WRP, /* 写保护错误 */ FLASH_COMPLETE, /* 操作完成 */FLASH_TIMEOUT /* 操作超时 */}FLASH_Status;(3)往上⼀步擦写成功的页写⼊数据STM32 闪存的编程每次必须写⼊16 位。
虽然固件库中有如下三个写操作的函数:左右滑动查看全部代码>>>FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data);FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);FLASH_StatusFLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data);分别为按字(32bit)写⼊、按半字(16bit)写⼊、按字节(8bit)写⼊函数。
TRACE32系列仿真器介绍
Trace32-ICE的结构
Host Connection
To Target
深圳旋极
TRACE32-ICE
深圳旋极
TRACE32-ICE的基本模块
仿真头Emulation Probe 仿真头 仿真基本模块Emulation Base 仿真基本模块 逻辑分析仪State Analyzer 逻辑分析仪
Trace模块
ROM 调试器(ESI) 激励产生器(STG) 强力探测器(PowerProbe)
深圳旋极
TRACE32-ICD 的扩展
PC ISA-Karte TRACE-32-ECU PODSCU with SCU PODBUS Cable ICD Interface EPROM Simulator (optional)
Memory 测试 硬件断点功能,TRACE32可以在FLASH或EPROM 中直接调试 支持多CPU调试 丰富的断点类型 支持MMU, FPU调试 上下文追踪系统CTS(Context Tracing System) 条件执行功能(STEP,GO) ...
深圳旋极
TRACE32——开放的体系结构
硬件设计模快化 Easy adaptation to new derivatives 开放的调试接口 Easy integration with Compilers, RTOS, CASE tools 开放的主机接口 Easy portable to other Host platforms
深圳旋极
常见的调试接口
BDM:背景调试模式 – Background Debug Mode –主要由Motorola使用,用于调试 –有6Pin和10Pin两种形式 JTAG:边界扫描
–边界扫描来源于IEEE Std 1149.1,是由联合测 试行动小组(Joint Test Action Group)制定的 一种测试逻辑,所以又称JTAG标准. –基本功能(必须实现)是边界扫描测试 – 调试功能(可选)
trace32使用手册-图文
trace32使用手册-图文Trace32是一款功能强大的实时调试和跟踪工具,它支持多种处理器和微控制器的开发和调试。
它具有丰富的调试功能和直观的图形用户界面,可帮助开发人员快速定位和解决软件缺陷。
本文将详细介绍Trace32的使用方法,包括环境配置、调试基本操作以及常用命令。
一、环境配置在开始使用Trace32之前,我们需要进行一些环境配置。
首先,我们需要将Trace32安装到开发计算机上。
在安装完成后,我们需要配置Trace32与目标设备的连接。
具体步骤如下:1. 连接目标设备的调试接口和开发计算机的引导接口。
这样,我们就可以通过Trace32连接到目标设备。
2. 启动Trace32,并选择"Connect"选项。
然后,选择适配器和目标设备的连接方式。
3.配置连接选项,包括目标设备的型号和调试接口。
4. 完成连接配置后,点击"Connect"按钮,Trace32将尝试与目标设备建立连接。
二、调试基本操作Trace32提供了一系列的调试工具和选项,可以帮助开发人员定位和修复软件错误。
下面是一些常见的调试操作:2. 设置断点。
Trace32允许我们在软件的特定位置设置断点,以便在执行到断点位置时暂停软件运行。
我们可以通过命令行或图形界面设置断点,以及设置条件断点和硬件断点。
3.单步调试。
当软件执行到断点或者处于暂停状态时,我们可以使用单步调试功能,逐条指令地执行软件。
这样,我们可以更加详细地了解软件的执行过程,并分析软件的状态和变量值。
4. 查看寄存器和变量值。
Trace32允许我们查看目标设备上的寄存器和变量的值。
我们可以通过Trace32的寄存器窗口或变量窗口查看这些值,并在调试过程中对这些值进行修改。
5. 追踪函数调用和函数返回。
Trace32可以追踪函数的调用和返回过程,以帮助开发人员理解软件的执行流程和函数调用关系。
6. 监视程序性能。
Trace32可以监视程序的性能指标,如执行时间、内存占用等。
Flash CS3 输出信息trace( )
Flash CS3 输出信息trace( )
trace( )动作用于输出某一动作执行时的自定义信息,它不出现在最终影片中,并且不影响影片脚本。
通常在调试时显示表达式或写入日志文件,单个跟踪语句可支持多个参数。
如果跟踪语句中的任何参数包含String之外的数据类型,则跟踪函数将调用与该数据类型关联的toString()方法。
例如,如果该参数是一个布尔值,则跟踪函数将调用Boolean.toString()并显示返回值。
1。
参数
该参数用于要计算的一个或多个(逗号分隔)表达式。
对于多个表达式,输出中每个表达式之间都将插入一个空格。
2。
脚本示例
下面的示例使用类TraceExample来演示如何使用trace()方法输出简单字符串。
通常情况下,消息将输出到【调试】控制台。
package {
import flash.display.Sprite;
public class TraceExample extends Sprite {
public function TraceExample() {
trace("Hello World");
}
}
};。
trace32使用手册
置调试源文件路径。
四、 观察/修改寄存器 从主菜单区点击“CPU->CPU Registers” ,打开内核寄存器窗口,如下图所示。 Pic11. 内核寄存器观察菜单
Pic12. 内核寄存器窗口
从 Pic12 所示的内核寄存器窗口, 用户能够观察处理器内核寄存器的值。 如果用户想 修改某一个寄存器的值, 只要双击寄存器名右边的值, 在行命令输入区就会出现相应 寄存器值修改的命令,紧接着输入十六进制的值(如,0x12345678)并回车就可以了。 下图是以修改寄存器 R2 的值为例,在行命令输入区出现的命令。 Pic13. 修改内核寄存器
Pic29 中红框内的单选钮 IMASKASM 和 IMASKHLL 选择之后,单步时就会屏蔽中断。 用户也可以通过命令 sys.o imaskasm on 和 sys.o imaskhll on 来设置这两个选项。
十、 设置软件断点 设置软件断点可以在命令行输入命令 break.set <address> /soft 来实现,在命令中的 <address>代表程序地址,可以是程序中的函数名等符号。如下图所示。 Pic30. 用命令设置软件断点
六、 下载程序 使用 data.load 命令实现程序下载的功能,如下图所示。 Pic20. 下载程序 上图中,“elf”指示所下载的程序的文件格式,“/v”指示程序下载完成之后进行校验。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
使用 Trace32 对 FLASH 编程随着软硬件复杂性的增加,在嵌入式系统开发中,调试器对项目的开发进度、质量起着越来越重要的作用。
在众多的调试器中,Lauterbach 公司的 Trace32 凭借其强大的功能,出色的性能,成为目前嵌入式系统开发中,尤其是高端系统中普遍采用的调试工具。
Trace32 除了具有对代码设置断点、跟踪调试等常规的功能以外,还能够控制对目标系统的FLASH 进行编程。
本文首先对比了 Trace32 FLASH 编程的两种方式:"Emulator controlled flash programming" 和 "Target controlled flash programming",指出"Target controlled flash programming"方式的优点;然后介绍了与 FLASH 编程相关的 Trace32 脚本命令,以及Trace32 脚本命令与 FLASH 编程软件之间的通信机制;最后,给出了 "Target controlled flash programming" 方式的控制流程。
注:本文中使用的"编程"一词,除了具有对 FLASH 烧写的含义外,还包括擦除、校验等其它对 FLASH 的操作。
一、FLASH 编程的两种方式对目标系统中的 FLASH 有两种方式进行编程,分别是 "Emulator controlled flash programming" 和"Target controlled flash programming"。
在 "Emulator controlled flash programming" 方式下,所有对 FLASH 编程的操作都是由Emulator 完成的,不使用目标系统的资源。
Trace32 软件支持市面上几乎所有的 FLASH芯片,只要在脚本命令 FLASH.Create 中指明目标 FLASH 的型号,地址范围以及总线的配置,用户就可以使用脚本命令直接将数据烧写到 FLASH,不需要编写任何对 FLASH 操作的代码。
在"Target controlled flash programming"方式下,对 FLASH 的编程控制是由运行在目标系统上的 FLASH 编程软件完成的,而这个软件必须由用户自行开发。
此时,Trace32通过使用脚本对目标系统内存地址空间的访问,向 FLASH 编程软件传送控制参数和数据。
由于直接在目标系统的处理器上运行,采用"Target controlled flash programming" 方式可以获得比"Emulator controlled flash programming"方式快得多的编程速度。
这对于烧写大的文件,以及生产线等场合来说十分重要。
另外,只要编写相应的 FLASH 编程软件,用户选择的任何 FLASH 都能够被支持。
因此,对于 FLASH 编程的内容较少,或者对编程的时间要求不高的情况下,可以使用"Emulator controlled flash programming" 方式;但是,对于需要编程较大的文件,而且对速度要求较高的情况下,"Target controlled flash programming" 方式是唯一的选择。
本文中只讨论"Target controlled flash programming" 方式。
二、Trace32 脚本在 Trace32 的界面中,可以使用菜单,鼠标完成操作,也可以完全使用命令操作。
事实上,Trace32 内嵌了强大的命令和脚本处理功能。
使用 Trace32 的命令不仅可以完成所有的功能,而且可以获得比菜单方式更大的操纵性和灵活性。
脚本以 .CMM 为后缀。
下面就介绍 Trace32 中与 FLASH 操作相关的命令,见下表:这里列出后面需要使用到命令的详细格式,以便参考。
1. FLASH.Create格式:FLASH.Create <unit_number> <physical_range> <sector_size> <family_code><bus_width><family_code>: I28F001B | I28F200B | ... | TARGET | EEPROM | NOP<bus_width>: Byte | Word | Long | Quad例如,定义Am29LV640(16 bit mode, 16 bit bus, 128 sectors, 64Kbyte/sector)FLASH.RESetFLASH.Create 1. 0x0 -- 0x7FFFFF 0x10000 AM29LV100 Word对于采用"Target controlled flash programming" 方式,familiy_code 必须选择为TARGET。
与 FLASH 编程软件的连接由 FLASH.Target 完成。
2. FLASH.Erase格式:FLASH.Erase <unit> | <address_range> | ALL例如:FLASH.Erase 0x0 -- 0x1FFFFFLASH.Erase ALL3. FLASH.Program格式:FLASH.Program [<unit> | <address_range> | ALL | OFF]一旦激活了编程模式,任何对 FLASH 地址空间的写访问操作将会导致对 FLASH 的编程。
例如:FLASH.Program ALLData.LOAD.Binary data.bin /Word <- 装载数据到FLASH空间FLASH.Program OFF…4. FLASH.TARGET格式:FLASH.TARGET <code_address> <data_address> [<buffer_size>] [<file>] <code_address>运行在目标系统上的 FLASH 编程软件被下载到的 RAM 起始地址,占用的大小为FLASH 编程软件本身的大小,另外再加上 32 字节。
<data_address>参数块的起始地址,大小为 32 字节(参数块)+ <buffer_size> + 256 字节(stack)。
<buffer_size>从 Trace32 软件一次传递给 FLASH 编程软件的数据字节数。
建议的缓冲大小为 4KB。
<FLASH_algorithm>二进制形式的 FLASH 编程软件。
使用上面这些命令进行 FLASH 编程的一般步骤是:1)首先使用 FLASH.Create 定义目标 FLASH 的地址空间,类型,及总线配置。
2)对于"Target controlled flash programming"方式,必须向目标系统加载 FLASH 编程软件。
FLASH.Target 命令把 FLASH 编程软件的起始地址,参数块的起始地址,以及缓冲区大小等信息通知 Trace32。
FLASH.Program 和 FLASH.Erase 命令就会调用确定的 FLASH 编程软件,并传递合适的参数。
3) FLASH.Program 启动编程模式后,如果有数据传输命令执行(如 Data.Set 或者Data.LOAD),Trace32 会检查数据传输的地址是否落在1)中定义的 FLASH 地址空间内。
如果是,Trace32 会根据缓冲区的大小,把部分数据填充到数据缓冲区中,初始化参数块,设置目标系统的 PC 为 FLASH 编程软件的起始地址,并开始执行。
执行结束后,控制权回到 Trace32。
Trace32 检查返回的信息(也在参数块中),如果正常,继续处理剩余的数据。
下面通过一个例子来说明:目标系统的配置了的 FLASH 为Intel Strata FLASH 28F320J3A(16 bit mode, word access),CPU 为 ARM core。
目标系统的内存影像(memory map)为:FLASH: 0x0 - 0x3FFFFFRAM 起始地址:0xA0000000相应的 Trace32 脚本为:FLASH.RESetFLASH.Create 1. 0x0--0x3FFFFF 0x20000 TARGET WordFLASH.Target 0xA0000000 0xA0001000 0x1000 ~~\demo\arm\FLASH\word\i28f200j3.bin FLASH.Erase 1.FLASH.Program 1.Data.LOAD.Elf my_application.elf /WordFLASH.Program OFF首先,通过 FLASH.Create 创建一个 FLASH 区域1,地址范围为 0x0 到 0x3FFFFF,Sector 的大小为 0x20000,对此 FLASH 区域的编程软件由 TARGET 指定。
WORD 参数则指明目标系统 CPU 访问 FLASH 的数据宽度(还可以是BYTE, LONG, QUAD)。
FLASH.Target 指定对 FLASH 区域编程软件的位置在 0xA0000000,参数块在0xA0001000。
参数块后面一般紧跟着数据缓冲区,缓冲区的大小为 0x1000。
编程软件是~~\demo\arm\FLASH\word\i28f200j3.bin。
接着擦除 FLASH 区域1,然后启动 FLASH 编程模式。
Data.load.elf 命令将 my_application.elf 装载到 FLASH 区域,触发了 FLASH 编程软件,从而被写入到指定的 FLASH 区域中。
最后,关闭 FLASH 编程模式。
三、Trace32 命令与 FLASH 编程软件之间的通信机制从上面的例子可知,在 Trace32 软件与 FLASH 操作程序之间有一个数据交换区-参数块,用来传递控制命令和数据,并返回操作结果。
参数块的位置是由FLASH.Target命令中的data_address指定的。