2

The question is rather broad but I couldn't even find a starting point in the ARMv7 ARM, MPCore TRM, GIC architecture manual, ... So please excuse the vagueness.

I have a simple bare-metal kernel for the Raspberry Pi 2 that initializes the activity LED, UART0, MMU and caches and everything works. I can blink, I can output text, I can map physical pages to virtual addresses and access them. So far so good.

Now I want to start up the additional cores and there I've run into a vacuum. There aren't yet examples of how to do this short of the linux kernel, which is rather complex because it supports so many boards. And looking at the specs I can't seem to find any good starting point. So instead of tapsing around in the dark I came here. :)

So has anyone else looked into this and figured out what state the cores are on boot and reset? What boot protocol / mechanism is used to start aditional cores? The one info I have found is that this is rather SOC specific so please no examples how to do this on a Cortex-A9 or something else that isn't a RPi 2.

4

1 回答 1

7

在 RPi 2 上,所有内核在上电时由固件启动,然后等待将起始地址写入邮箱。发生这种情况时,它们会跳转到刚刚写入的地址。所以启动额外的核心非常容易:

// wakeup stub in asm (sets up stack and calls core_main())
extern void core_wakeup(void);
typedef void (*fn)(void);
void wakeup(int num) {
    *(volatile fn *)(0x4000008C + 0x10 * num) = core_wakeup;
}

应该在所有内核上禁用缓存或在所有内核上启用它们。缓存窥探仅适用于缓存启用,因此启用/禁用缓存的任何混合都会有不一致的情况。

于 2015-02-23T20:13:30.137 回答