ARM11 learning basic knowledge based on S3C6410

Publisher:创新之星Latest update time:2021-02-06 Source: eefocusKeywords:S3C6410  ARM11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The development of ARM11 is very different from the STM32 development that we learned before. For STM32, the code is burned into the STM32 chip FLASH, and then the code is executed from the FLASH. Moreover, the program execution does not require external RAM, because a certain amount of RAM is integrated inside the chip.


ARM11 is different. It does not have FLASH and RAM inside, so it requires external flash devices and RAM devices, and then ARM11 operates these devices through the storage controller.



The difference can be seen intuitively from the picture. For S3C6410, because there is no internal memory, the code needs to be burned into an external FLASH device. There can be many types of FLASH devices here, but they must be flash supported by the chip. This is explained in the chip data sheet. Program execution requires memory, so an external memory device is also required to execute the program. There can also be many types of memory devices here, but it is also necessary to check the chip data sheet to see which memory device is supported.


The two development methods are also different. When developing STM32 programs, we basically use the Keil graphical interface. Compiling and linking are all handled by the compiler. We don't need to write makefiles, link scripts, or startup codes, because ST has done all of these for us. And the programs we write are basically written in C language.


But ARM11 development is different. It needs to be developed in Linux and a cross-compilation tool chain needs to be installed. At this time, there is no graphical development interface. You need to write your own makefile and link script. More importantly, you need to write your own bootloader, which is the startup code.


The instructions of the two developments are also different. ARM11 uses ARM instructions, which are 32-bit instructions, and are all 4-byte aligned. However, STM32 uses THUMB2 instructions, which include THUMB's 16-bit instructions, so the instructions are not strictly 4-byte aligned. But when writing STM32 programs, they are all written in C language, so I don't care much about these.


But developing in ARM11 is different, because when developing bootloader code, it needs to be written in assembly code, so you need to be familiar with ARM11 assembly instructions. You need to be able to write makefiles and link scripts.


Of course, there are many other differences between STM32 and ARM11, which I will not introduce here, and will explain in detail when I get to the specific places.


Let's first understand the startup process of ARM11.



This is a screenshot from the ARM boot manual. The BL in the picture refers to the bootloader.


1. After power-on, the program first executes the BL0 program, which is the program that the chip manufacturer has fixed in the chip. In this program, there will be some initialization things, the most important of which is the initialization of the memory controller, so that the chip can access the external FLASH boot device.


2. After BL0 is initialized, it will copy the first 8K data of the external boot storage device to the stepping stone according to the boot pin selection (because ARM11 supports multiple storage media boot), and then jump to the stepping stone for execution. At this time, the BL1 program we wrote is executed.


3. In the BL1 program, we will set some registers of the chip and initialize some external peripherals, such as nandflash, dram, serial port, etc. And configure the C language environment, because the subsequent programs may be written in C language. Then copy the remaining programs over 8K in the external storage boot device to DRAM, and then jump to DRAM to execute the program.


Therefore, we first need to set the BL1 program. In this program, we need to set some registers of the chip, initialize the external peripherals, and then copy the code in FLASH to DRAM, set the C language environment, that is, configure the heap, stack, and clear the BSS segment.



Let's look at the STM32 startup process. After power-on, the chip will collect the values ​​of the boot0 and boot1 pins, and then decide whether to start from FLASH or RAM. After selecting, the startup code program will be executed, the stack will be defined (the stack size and address will be set), and then the interrupt vector table will be set, and then the clock and NVIC will be initialized. Then _main will be called. Note that _main here is not the main function we wrote, but the system's own function. This function is to initialize the resources required by C, that is, to set the stack, map the variables in the code to the memory, and then jump to the main function we wrote to start executing the program we wrote.


It can be seen that STM32 is relatively simple, because ST has already done all the work for STM32, that is, the startup assembly code added before writing the program, so what we care about is the design of the main function we wrote. But in ARM11, in addition to caring about our main function design, we also need to care about the bootloader design.


Without further ado, let’s move on to ARM11.


First of all, you must install the compilation environment. First, you need to install a virtual machine, and then install the cross tool chain on the virtual machine. That is, the arm-linux-compilation tool. There are many tutorials on the Internet, and you can achieve it by referring to the tutorials.


Then comes the writing of the program, that is, the writing of the bootloader. Here, the bootloader program is saved in the start.S file. In addition, the program is finally placed in nandflash, and the program is started from nandflash. I named this bootloader qboot.


Then write the makefile.



Codeall: start.o
	arm-linux-ld -Tqboot.lds -o qboot.elf $^
	arm-linux-objcopy -O binary qboot.elf qboot.bin
	arm-linux-objdump -D -S qboot.elf > dump
	
%.o : %.S
	arm-linux-gcc -g -c $^
%.o : %.c
	arm-linux-gcc -g -c $^
	
clean:
	rm *.o *.elf dump




In fact, it is also very simple, just convert the start.S assembly code we wrote into a bin file. Because the bin file can be burned into nandflah and executed by the chip.


Then write the link script




+ View Code


ENTRY(_start) @ The program entry is _start


SECTIONS{


. = 0x50008000; @ The starting address of the link is 0x50008000


. = ALIGN(4); @ Address 4-byte alignment


.text : @ code snippet


{


start.o(.text) @ start code segment is placed first


*(.text) @ * represents all the remaining codes


}


. = ALIGN(4); @ Code segment address, 4-byte alignment


.data : @ data section


{


*(.data) @ all data segments


}


. = ALIGN(4); @ bss segment address, 4-byte alignment


bss_start = .; @ indicates the starting address of the bss_start segment, which will be used later


.bss :


{


*(.bss) @ all bss segments


}


bss_end = .; @ indicates the end address of the bss_start segment, which will be used later


}






The link script is used to determine the address of program instructions later. In the link script, the link address of the code segment, data segment, and bss segment must be set. The starting address of the link here is 0x50008000, which is within the address range of the memory, which is reflected in the data manual.



From the figure, we can see that the address range of the first dram starts from 0x50000000 and ends at 0x5FFFFFFF. So here we set the link address to this range, because the program will be copied to the memory and executed in the memory later.


With these basic things, you can start your programming journey.


Keywords:S3C6410  ARM11 Reference address:ARM11 learning basic knowledge based on S3C6410

Previous article:ARM high-resolution piezoelectric ceramic drive power supply design
Next article:Arm system architecture knowledge summary

Recommended ReadingLatest update time:2024-11-16 11:50

(ARM11 S3C6410) ARM11 bare metal first experience, GPIO register
When you get an unfamiliar MCU, you usually want to run the bare metal first. ... Usually the first thing you do is to look at the GPIO registers. OK6410 development board circuit diagram. 6410 IO port resources... The register address you want to close GPMCON: IO po
[Microcontroller]
(ARM11 S3C6410) ARM11 bare metal first experience, GPIO register
U-Boot-2011.06 transplant modification plan that supports S3C6410 processor SD card boot mode
Universal Bootloader (U-Boot) is the first piece of code executed after the system is powered on. Its functions mainly include initializing the hardware environment and loading and executing the operating system kernel. When installing the system, U-Boot usually needs to be programmed into FLASH using special tools, a
[Microcontroller]
U-Boot-2011.06 transplant modification plan that supports S3C6410 processor SD card boot mode
S3C6410 GPIO operation interface
1. Configure GPIO         When using the pins of S3C6410, you need to configure them, such as configuring them as input/output/interrupt functions, according to the chip manual. All these configurations are done in Gpiolib.c (/arch/arm/plat-s3c64xx). Of course, you can use the basic __raw_readl and __raw_writel to ope
[Microcontroller]
ARM11 learning based on S3C6410 (XV) MMU is here
Now, we have come to the world of main. Next, we will experience the MMU of ARM11, which is not available in STM32. Previously, during the core initialization process, the MMU function was turned off. That is because at that time, the operations were all physical addresses, so the MMU needed to be turned off.  MMU,
[Microcontroller]
ARM11 learning based on S3C6410 (XV) MMU is here
S3C6410 memory, address mapping and chip startup
S3C6410 Chapter 1 Introduction to Memory, Address Mapping and Chip Startup I have been listening to classes at Shangguan for a while, and the gains are so-so, and there is nothing particularly exciting. As of today, the ARM content has ended, and I am not very interested in some classes. According to my habit of not
[Microcontroller]
Linux 3.3.0 ported to one of the S3C6410 development boards
Here we have only successfully transplanted the kernel, and can mount the file system to run. Drivers will be added in succession. Step 1: Download the latest kernel from the kernel official website. I downloaded linux-3.3-rc3.tar.bz2. Step 2: Unzip the kernel and enter the arch/arm/mach-s3c64x
[Microcontroller]
Home monitoring moving target detection system based on S3C6410 processor and Linux
The ARM11 (S3C6410) processor was selected as the hardware platform, the embedded Linux operating system was used as the software platform, the background difference method and the inter-frame difference method of comprehensive moving image detection were used as algorithms, and combined with the GSM module, an applic
[Microcontroller]
Home monitoring moving target detection system based on S3C6410 processor and Linux
ARM11 learning based on S3C6410 (IV) Core initialization and setting processor mode
The interrupt vector table has been set before, and now we need to set the processor mode. For ARM11, there are 8 modes, and different modes have different permissions. When developing the bootloader, we need to set the processor mode to Supervisor mode, that is, SVC mode. In this way, the permissions are high and all
[Microcontroller]
ARM11 learning based on S3C6410 (IV) Core initialization and setting processor mode
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号