/* Call all initialization functions in a loop*/
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr)
{
if ((*init_fnc_ptr)() != 0)
{
/* When each function fails to initialize, it will hang here. */
hang();
}
}
Last time, we talked about calling all initialization functions in the function pointer array for initialization. Now let's analyze in detail what they do, what kind of initialization they do, and how to prepare for the subsequent operation. The first initialization function is CPU initialization (cpu_init). This function is in cpu/s3c44b0/cpu.c. Its function is to perform S3C44B0 initialization. The content of this function is as follows:
/*
CPU initialization.
Cai Junsheng 2005/07/23
*/
int cpu_init (void)
{
/* Clear the buffer */
icache_enable();
return 0;
}
It calls the function icache_enable(), which is used to initialize the buffer of S3C44B0 and enable the CPU buffer. Because after the CPU is powered on, its initialization value is not to enable the internal 8K buffer, which must be set by the program. Then see how the called function initializes the internal buffer?
/*
CPU memory buffer initialization.
Cai Junsheng 2005/07/23
*/
void icache_enable (void)
{
ulong reg;
/* Clear the memory buffer. */
s3c44b0_flush_cache();
/*
Initialize the buffer and
set the start and end addresses of the non-buffer.
The first register indicates that the following address should not be cached. The lower 16 bits are the start address and
the upper 16 bits are the end address. And the space size is bounded by 4K.
0x0000:0000 - 0x0C00:0000
*/
NCACHBE0 = 0xC0000000;
NCACHBE1 = 0x00000000;
/*
Set SYSCFG register to enable 8K buffer.
*/
reg = SYSCFG;
reg |= 0x00000006; /* 8kB */
SYSCFG = reg;
}
In this function, the first function called is to clear the buffer. It has some special features, as follows:
/*
Initialize the internal buffer of the CPU.
Cai Junsheng 2005/07/23
*/
static void s3c44b0_flush_cache(void)
{
volatile int i;
/* Clear the buffer. Each time, read and write 4 32-bit bytes, so add 16. */
for( i = 0x10002000; i < 0x10004800; i += 16 )
{
*((int *)i)=0x0;
}
}
It uses a for loop to initialize the internal buffer. Since S3C44B0 determines that each read and write is performed by 16 bytes. Therefore, i here is constantly adding 16 bytes. However, why is the area from 0x10000000 to 0x10001fff not cleared here? I don't understand this either. I will try to clear it when I have time to see if there is any problem!
So far, the buffer has been cleared, and it is necessary to set those memory areas not to be cached. Because not all memory needs to be buffered, for example, reading external IO does not require buffering; reading FLASH does not require buffering. Therefore, set the starting address of the first non-buffer to NCACHBE0 = 0xC0000000. The lower 16 bits of this value are the starting address 0x0000, and its 32-bit address starts from 0x00000000. Its upper 16 bits are the ending address 0Xc000, and its 32-bit address ends from 0Xc0000000. Finally, by setting the value of the [2:1] bit of the SYSCFG register to 11, the 8K memory data and instruction buffers are enabled. So far, the CPU buffer initialization and enablement have been set.
Previous article:Learn ARM development(11)
Next article:Learn ARM development(9)
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- How to design an HDMI digital interface converter based on a single chip
- Running the C interpreter on ESP32
- 【GD32E503 Review】+ W5500 Network Module Transplantation
- I have a question about 7060 chip burning!
- What is a patch antenna?
- [TI star product limited time purchase] +LAUNCHXL-CC2640R2 development board
- Sharing of stepper motor control board based on TB67S109AFNAG
- SensiML Industrial Monitoring Demo ST SensorTile
- Looking to buy a set of black gold ZYNQ 7020/7010 development board
- Looking for a chip that drives multiple indicator lights