1. Storage Controller Introduction
The Storage Manager in s3c2440 provides the signals needed to access external devices, with the following features:
1. Support small byte order, large byte order (through software selection)
2. Each bank is 128M, a total of 8 bank, a total of 1G
3.BANK0~BANK5 can support external ROM, SRAM, etc.,bank6~bank7 in addition to support ROM, SRAM and support SDRAM
The starting address of the 4.BANK0~BANK7 is fixed.
5. Support Self-refresh and Power save mode when external SDRAM
s3c2440 on the Addr0~addr26 access range only 128M, how to reach the above 1G, through the external 8 with the chip selection signal NGCS0-NGCS7, corresponding to the BANK0~BANK7. The chip selection signal output is low to select the appropriate external device.
2. Experiment Code
The experimental process:
disable watchdog->nand Flash in front 4k byte copy to chip internal SRAM execution, sdram-> via storage controller initial connection copy the code into SDRAM, and jump to the SDRAM to execute.
Here are the relevant registers that need to be configured for the storage controller and need to look at the manual:
0x22011110, //bwscon0x00000700, //bankcon00x00000700, //bankcon10x00000700, // bankcon20x00000700, //bankcon3 0x00000700, //bankcon40x00000700, //bankcon50x00018005, // bankcon60x00018005, //bankcon70x008c07a3, //refresh0x000000b1, //banksize0x00000030, // mrsrb60x00000030, //mrsrb7
Head. S
. equ mem_ctl_base, 0x48000000//.euq A B is the a=b equivalent to the C language macro definition. equ sdram_base, 0x30000000.text.global _start_sta RT:BL Disable_watch_dogbl memsetup//Set Storage controller BL Copy_steppingstone_to_sdram//Copy code to SDRAM in LDR pc, =on_s DRAM//Jump into SDRAM perform ON_SDRAM:LDR SP, =0x34000000//Set stack bl mainhalt_loop:b halt_loopdisable_watch_dog : mov r1, #0x53000000mov R2, #0x0str R2, [R1]//Turn off watchdog MOV pc, LR//Return Copy_steppingston E_to_sdram:mov R1, #0x0ldr R2, =sdram_basemov R3, #4 *10241:ldr R4, [R1], #4str R4, [R2], #4cmp R1, R3bne 1b Bne b jump NE is not equal indicates if not equal, jump to 1 out to continue execution Note 1 is not l ... mov pc, Lrmemsetup:mov R1, #MEM_CTL_BASEadrl R2, Mem_cfg_valadd R3, R1, #521: Ldr R4, [R2], #4str R4, [R1], #4cmp R1, R3bne 1bmov pc, Lr.align 4mem_cfg_val: The value of 13 registers in the storage controller. Long 0x22011110.long 0x00000700.long 0x00000700 . Long 0x00000700.long 0x00000700.long 0x00000700.long 0x00000700.long 0x00018005.long0x00018005.long 0x008c07a3.long 0x000000b1.long 0x00000030.long 0x00000030
Makefile
Sdram.bin:head. S led.carm-linux-gcc-c head. S-o head.oarm-linux-gcc-c led.c-o led.oarm-linux-ld-ttext 0x30000000 head.o led.o-o Sdram_elfarm-linux-objcopy-o Bin Ary-s sdram_elf sdram.binarm-linux-objdump-d-M arm sdram_elf > SDRAM.DISCLEAN:RM-RF *.o *.bin *.dis *elf
Test with the LED.C, feel free to select the previous article in the LED lighting program can be.
Note: Original article, reprint please famous source: http://blog.csdn.net/scottly1/article/details/38960751
"Embedded Linux+arm" storage controller (Operation SDRAM)