让vdsp与uclinux共舞(10):加载SMP内核

快乐虾

http://blog.csdn.net/lights_joy/

[email protected]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

本文适用于

ADSP-BF561

Visual DSP++ 5.0(update 6)

Bfin-uclinux-2009r1.6

 

 

欢迎转载,但请保留作者信息

 

 

下面试试加载SMP内核,首先编译一个支持SMP的内核,仍然关闭PLL配置。

1.1.1   当前VDSP的状态

A核加载并运行uboot

B核运行一段空闲代码,这是为了a核的PLL配置不得不为之。

1.1.2   面临的问题

当内核启动时,b核的启动代码是由a核写入L1 SRAM再启动b核运行的。内核假设此时B核是处于关闭状态的,如果检测到B核已经打开则认为是一个BUG

1.1.3   解决方法

a核启动b核前通过SICB_SYSCRB核一个信号并等待,此时我们可以在vdsp下运行b核,然后在b核启动后再给a核一个确认信号,这样就OK了。

这里还有一个问题,此时b核的PC指针并不处于0xff600000,因为它此前正在运行一段空闲代码。因此我们必须手工把b核的pc指针设置为0xff600000,然后再运行。

我们需要修改arch/blackfin/mach-bf561/smp.c文件,首先在a核中加入等待的代码:

int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle)

{

     unsigned long timeout;

 

     /* CoreB already running?! */

     //BUG_ON((bfin_read_SICA_SYSCR() & COREB_SRAM_INIT) == 0);

 

     printk(KERN_INFO "Booting Core B./n");

 

     spin_lock(&boot_lock);

 

     if((bfin_read_SICA_SYSCR() & COREB_SRAM_INIT) == 0)

     {

         // 提示用户在vdsp下运行b核并等待

         printk(KERN_INFO "please run coreb under vdsp. /n");

         bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);

         SSYNC();

         while(bfin_read_SICB_SYSCR() & 0x0080) udelay(100);

     }

 

     /* Kick CoreB, which should start execution from CORE_SRAM_BASE. */

     SSYNC();

     bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() & ~COREB_SRAM_INIT);

     SSYNC();

 

     timeout = jiffies + 1 * HZ;

     while (time_before(jiffies, timeout)) {

         if (cpu_isset(cpu, cpu_callin_map))

              break;

         udelay(100);

         barrier();

     }

 

     spin_unlock(&boot_lock);

 

     return cpu_isset(cpu, cpu_callin_map) ? 0 : -ENOSYS;

}

在这里我们注释掉了最前面的BUG_ON,然后加了一个if语句判断COREB_SRAM_INIT,当我们不使用vdsp加载时,这个条件并不满足,因此里面的代码也不会执行,不会影响内核的启动。

接着我们要让b核启动后给a核一个启动信号:

void __cpuinit platform_secondary_init(unsigned int cpu)

{

     ………….

 

     // a核确认我们已经开始运行

     bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0800);

}

搞定。

1.1.4   内核启动

console我们可以看到完整的启动过程:

bfin>bootm 2800000

## Booting kernel from Legacy Image at 02800000 ...

   Image Name:   Linux-2.6.28.10-ADI-2009R1

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    3409881 Bytes =  3.3 MB

   Load Address: 00001000

   Entry Point:  001e1a88

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001e1a88

Linux version 2.6.28.10-ADI-2009R1 ([email protected]) (gcc version 4.1.2 (ADI svn)) #60 SMP Wed Nov 4 09:57:24 CST 2009

bootconsole [early_shadow0] enabled

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x000ff910

  rodata    = 0x000ff920-0x0014cc34

  bss       = 0x0014d000-0x001c30e4

  data      = 0x001c3100-0x001d4000

    stack   = 0x001d2000-0x001d4000

  init      = 0x001d4000-0x006ba000

  available = 0x006ba000-0x03eff000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Reset caused by Software reset

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF561 Rev 0.5

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 599 MHz core clock and 99 MHz System Clock

NOMPU: setting up cplb tables

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-through)

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 16001

Kernel command line: console=ttyBF0,57600n8

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 256 (order: 8, 1024 bytes)

console [ttyBF0] enabled, bootconsole disabled

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 57024k/65536k RAM, (5016k init code, 1018k kernel code, 850k data, 1024k dma, 600k reserved)

Calibrating delay loop... 1187.84 BogoMIPS (lpj=2375680)

Security Framework initialized

Mount-cache hash table entries: 512

CoreB bootstrap code to SRAM ff600000 via DMA.

Booting Core B.

please run coreb under vdsp.

Instruction Cache Enabled for CPU1

Data Cache Enabled for CPU1 (write-through)

Calibrating delay loop... 1191.93 BogoMIPS (lpj=2383872)

Brought up 2 CPUs

SMP: Total of 2 processors activated (2383.87 BogoMIPS).

Blackfin Scratchpad data SRAM: 4 KB

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 16 KB (15 KB free)

Blackfin L1 Instruction SRAM: 16 KB (15 KB free)

Blackfin L2 SRAM: 128 KB (127 KB free)

net_namespace: 296 bytes

NET: Registered protocol family 16

Blackfin DMA Controller

ezkit_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 2, 16384 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NET: Registered protocol family 1

msgmni has been set to 111

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 35) is a BFIN-UART

brd: module loaded

dm9000 Ethernet Driver, V1.31

TCP cubic registered

NET: Registered protocol family 17

Freeing unused kernel memory: 5016k freed

dma_alloc_init: dma_page @ 0x006b7000 - 256 pages at 0x03f00000

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution /

       d888888b.         /       _     _                         /

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ / // /       |

       8'    .88       /        | |   | |  _ /| | | | /  /        |

       8`._.' Y8.       /       | |__ | | | | | |_| | /  /        |

      d/      `8b.       /      /____||_|_| |_|/____|/_//_/       |

     dP   .    Y8b.       /   For embedded processors including   |

    d8:'  "  `::88b        /    the Analog Devices Blackfin      /

   d8"         'Y88b        /___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

 ._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/

 /    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/

 /     /.___.d|    .'           - http://www.uclinux.org/

 `--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

 

Have a lot of fun...

 

 

BusyBox v1.13.4 (2009-10-29 17:49:42 CST) built-in shell (msh)

Enter 'help' for a list of built-in commands.

 

root:/> pwd

/

 

 

1.1.5   加载符号信息

下面我们在VDSP下中断下来,通过File -> Load symbol加载符号,为ab核指定相同的文件vmlinux

 

这样我们就可以看到有限的符号信息了。

1.1.6   驱动开发

与单核一样,只不过我们不知道驱动将由哪个核运行,因此我们在下载完成后需要为ab核重新加载一次符号信息,然后……………..

想怎么调试就怎么调试…………

 

近日,我家6岁的小姑娘参加了第六届POP全国少儿英语风采大赛,拉票进行中(2011-6-15前)。

请帮忙点击新东方网站的链接:

http://popdasai.xdf.cn/toupiao.php?do=space&uid=4237

投她一票,谢谢!

 

2       参考资料

vdspuclinux共舞(9):查找内核函数(2009-11-3)

vdspuclinux共舞8):vdsp驱动框架(2009-11-3)

vdspuclinux共舞(7):在内核为驱动预留空间(2009-11-2)

vdspuclinux共舞(6):用vdsp开发驱动的设想(2009-11-2)

vdspuclinux共舞(5):加入dwarf调试信息(2009-11-2)

vdspuclinux共舞(4):加载uclinux(2009-11-2)

vdspuclinux共舞(3):boot kernel(2009-10-31)

vdspuclinux共舞(2):vdsp的影响(2009-10-31)

VDSPuclinux共舞(1):开篇(2009-10-30)

关于uClinux-2.6(bf561) for VDSP的移植2008/3/11

 

 

 

 

你可能感兴趣的:(让vdsp与uclinux共舞(10):加载SMP内核)