After the program starts running, the RW and ZI segments need to be moved to the RAM. After the program is downloaded into the Flash, how are the RW and ZI segments moved to the RAM after power-on? Note that after initializing the .s file, IAR and ADS do not jump directly to the main function to execute. IAR jumps to?main and ADS jumps to the __main function. In these functions, according to the configuration of the icf file, the RW and ZI segments are moved to the RAM area specified by the icf file. If the runtime domain of the program is in the off-chip RAM, when does the program initialize the off-chip RAM controller? Because the beginning of the .s file is CODE RO, no RAM space is required, so the off-chip RAM can be configured in the .s file. There is another problem, which must be paid attention to during hardware design. If the program needs to be solidified in the external Flash, it must be noted that the external Flash must be a chip that the default off-chip bus supports after the chip is powered on.
How programs are debugged in RAM
For the convenience of debugging, sometimes the program does not need to be downloaded into the flash for debugging, but runs directly in the RAM. Set the ROM and RAM addresses in the icf file to the addresses of the hardware RAM, turn off the Flashloader, and the program will run in the RAM. But the problem arises again, because sometimes we want to debug the code in the external RAM, so the external RAM controller needs to be initialized before the code is downloaded into the RAM. How can it be achieved? IAR is implemented through the .mac file. It is executed before the program is downloaded. The program in the mac file, the following is an example
execUserFlashInit()
{
}
This example is an example of LPC initialization of external RAM. After configuring the external RAM, you can run the code in it.
IAR download of the program
1.
This is the simplest and most commonly used method. Generally, ARM chips have on-chip Flash, and IAR will download binary executable files to Flash through Flashloader. The download method is as follows: if you want to download program B to the chip, IAR first downloads a program A (a program pre-written by IAR) to the RAM on the chip, and then uses this program A to interact with Flashloader through JTAG to complete the download of program B.
2.
The program A downloaded into RAM by IAR must support the off-chip Flash and be able to erase the off-chip Flash. Often this program needs to be written by yourself. The download mechanism of HJTAG is the same. HJTAG lists many chips supported by HJTAG. The so-called support means that HJTAG has program A for these chips. In HJTAG, the address of the RAM to which program A will be downloaded must be specified, and the RAM at this address must be available. For example, if an off-chip SDRAM is used, the SDRAM controller must be initialized. This is done in the Init Script of HJTAG and in the mac file of IAR.
3.
Since these two methods do not require the participation of Flashloader, the loading domain and runtime domain of the program are the same. The program does not need to be moved after it is running, so you only need to specify the RAM address of the runtime domain to IAR. If it is internal RAM, it is very convenient. Just set the address to internal RAM in the icf file. If it is external RAM, initialize the external SDRAM controller or other RAM in the mac file, and then IAR can put the program in the initialized external RAM and run it.
Previous article:Many questions about single chip microcomputer
Next article:MSP430 Pull-up Resistors & Secondary Functions of I/O Ports
Recommended ReadingLatest update time:2024-11-15 11:25
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- An Algorithm for Simultaneous Operation of RF Multi-channels
- Find the period of the following TCL555 output square wave
- PIC18F26K80 INT0 interrupt does not work, see where the problem is
- [NXP Rapid IoT Review] + First Rapid IOT Studio Project
- At 10 am today, Datang NXP will broadcast a live broadcast of [New energy lithium battery management solution with impedance detection function]
- Can anyone help me figure out what chip model this is?
- 【Beetle ESP32-C3】8. OLED clock and weather assistant (Arduino)
- R7F0C003/004 series, using IAR development environment, are there any tutorials?
- PWM wave problem
- Typical uses of voltage followers