This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to bring secondary CPU1 on ARM v7

Hi,

I am trying to bring up CPU1 on ARM v7 architecture  (assume CPU0 already bring up & set c-environment)

using below code, but it hitting with error: "stack smashing detected"

ldr  sp, =cpu1_stack

b start_task2

* cpu1_stack define here :

int new_stack[1024]__attribute__ ((aligned(16)))   

I used PSCI framework to switch to cpu1

Please share some pointers/inputs whats going wrong here.

Parents
  • Though this is not really my field, I think you'd have to check which CPU is currently executing the code.

    Eg. If I had 4 CPUs, I'd create 4 stacks and set SP = stack[currentCPU];

    I think the page, which peterharris is referring to, will help you find the currently running CPU.

    Please know that I'm not an expert on the Cortex-A; so there's a good chance I'm wrong.

    However, if Peter happens to see this, I'm quite sure he would be able to give a more helpful answer.

Reply
  • Though this is not really my field, I think you'd have to check which CPU is currently executing the code.

    Eg. If I had 4 CPUs, I'd create 4 stacks and set SP = stack[currentCPU];

    I think the page, which peterharris is referring to, will help you find the currently running CPU.

    Please know that I'm not an expert on the Cortex-A; so there's a good chance I'm wrong.

    However, if Peter happens to see this, I'm quite sure he would be able to give a more helpful answer.

Children
  • However, if Peter happens to see this, I'm quite sure he would be able to give a more helpful answer

    No pressure

    To get the current CPU ID you'll need to use some assembler to access the System Control co-processor. You don't say what CPU you are using, but assuming some form of ARMv7A CortexA core you'll need to look at the bottom two bits of the Multiprocessor Affinity Register.

    For ARM-v7 32-bit code see: ARM Information Center

    For ARMv8 64-bit code see: ARM Information Center

    HTH,
    Pete