颠覆火影:ARM realview调试S3C2410初步

来源:百度文库 编辑:九乡新闻网 时间:2024/04/25 13:43:43
ARM realview调试S3C2410初步

ARM收购了Keil后,开发工具大有长进,一时之间,使用ADS的用户纷纷转向realview.
试用了一个版本3.53 的uvision.发现对LPC的支持相当的好,调试代码也很顺利,但是对S3C2410的调试好象是问题题不断.

学习了一段时间后,终于跑通了一个简单的例子.现将realview调试S3C2410的若干问题罗列出来
硬件平台:s3c2410, norflash 2M 16bits. nandflash 32 M , sdram 64M.

1 LPC与S3C2410硬件问题.
两者区别之一在于片上RAM和片上ROM的区别.由于LPC对片上RAM和ROM都有明确的说明,而S3C2410则没有片上ROM,只有4K片上内存。这4K内存实际上具有ROM功能。然而由于2410具有两种不同的启动方式,一种是从NAND,一种是从ROM(NOR FLASH),选择前者启动时,这4K可以作ROM使用, 选择后者时,4K地址分配到了较高位址在0X40000000处。

2 两种启动方式分别调试2410的工程

一开始分别设置好内存后按默认方式调试,在调试中出现外围设备寄存器不能写的情况:

*** error 65: access violation at 0x53000008 : no 'write' permission


比较一下LPC,发现其外围设备寄存器也在高地址,在Target 内存设定中并不需要特别指出.

为什么在2410中需要特别指定呢? 不得其解.

不得已之下使用Debug initialization文件,在文件中指定

map 0x48000000, 0x48000030 read write
map 0x49000000, 0x49000058 read write
map 0x4A000000, 0x4A00001C read write
map 0x4B000000, 0x4B0000E0 read write
map 0x4C000000, 0x4C000014 read write
map 0x4D000000, 0x4D000060 read write
map 0x4E000000, 0x4E000014 read write
map 0x50000000, 0x50008028 read write
map 0x51000000, 0x51000040 read write
map 0x52000000, 0x5200026F read write
map 0x53000000, 0x53000010 read write
map 0x54000000, 0x54000010 read write
map 0x55000000, 0x55000012 read write
map 0x56000000, 0x560000B0 read write
map 0x57000000, 0x57000100 read write
map 0x58000000, 0x58000010 read write
map 0x59000000, 0x59000020 read write
map 0x5A000000, 0x5A000040 read write

3 最后模拟调试成功的两种启动方式分别作了如下设置:
norflash方式:

.sct文件:

LR_ROM1 0x00000000         {    ; load region 2M norflash
ER_ROM1 0x00000000 0x0200000 { ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
}
RW_RAM1 0x30000000 0x4000000 { ; RW data 64M内存
   .ANY (+RW +ZI)
}
   RW_IRAM1 0x40000000 0x00001000 { 片内4K内存
   .ANY (+RW +ZI)
}
}

debug init文件:

pc=0x0
map 0x48000000, 0x48000030 read write
map 0x49000000, 0x49000058 read write
map 0x4A000000, 0x4A00001C read write
map 0x4B000000, 0x4B0000E0 read write
map 0x4C000000, 0x4C000014 read write
map 0x4D000000, 0x4D000060 read write
map 0x4E000000, 0x4E000014 read write
map 0x50000000, 0x50008028 read write
map 0x51000000, 0x51000040 read write
map 0x52000000, 0x5200026F read write
map 0x53000000, 0x53000010 read write
map 0x54000000, 0x54000010 read write
map 0x55000000, 0x55000012 read write
map 0x56000000, 0x560000B0 read write
map 0x57000000, 0x57000100 read write
map 0x58000000, 0x58000010 read write
map 0x59000000, 0x59000020 read write
map 0x5A000000, 0x5A000040 read write

nandflash方式:

sct文件:

LR_IROM1 0x00000000 0x00002000 {    ; load region size_region 4K的片内内存作为启动ROM
ER_IROM1 0x00000000 0x00002000 { ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
}
RW_RAM1 0x30000000 0x08000000 { ; RW data 64M内存
   .ANY (+RW +ZI)
}
}

LR_ROM1 0x08000000 0x00200000 { 2M norflash
ER_ROM1 0x08000000 0x00200000 { ; load address = execution address
   .ANY (+RO)
}
}

debug init文件与上面一样.