How to build an application for dual core(M4+M0) MCU?

Hello

I'm using Cortex-M3, and because of speed and peripherals, I want to use a dual core MCU.

I realized I have to write two separate code and make two separate executable file.

But I don't know how to merge these executable files.

I have to write down the executable files in separate specific region of flash?

Can anyone help me? I'm a little confused

Thank you

Parents
  • As allenwillson already mentioned, you can build two different executables:

    1. A Cortex-M0 executable
    2. A Cortex-M4 executable

    You convert the Cortex-M0 executable to a hex-file and from your Cortex-M4 code, you load the image and start the Cortex-M0 core.

    But there is a different way, which has not been covered in any documentation I know of.

    I write all the code in assembly language; sometimes I write some files in C for the Cortex-M4, though.

    But I write the Cortex-M0 code in assembly language, and I use GCC and GAS for building my project.

    I recommend that the first line of your assembly file is...

                             .syntax               unified

    Somewhere you want to tell the assembler, that you're about to write Cortex-M0 code, so before your Cortex-M0 code, write the following line:

                             .cpu                    cortex-m0

    ... If you at some point want to write cortex-m4 code in the same source file, just switch ...

                             .cpu                    cortex-m4

    Then you do not need to convert the code to a hex-file, you still need to start up the Cortex-M0 core from your Cortex-M4 code, but I find it a lot easier this way myself.

    Remember: You can share your Cortex-M0 code with the Cortex-M4. The Cortex-M4 can run the Cortex-M0 code, but the Cortex-M0 cannot run the Cortex-M4 code. But you should be careful. If the Cortex-M4 is running the Cortex-M0 code, then the Cortex-M4 is stalling the Cortex-M0, because they're suddenly accessing the same memory space.

    -So it's a good idea to keep the Cortex-M0 code in one Flash bank, and the Cortex-M4 code in the other Flash-bank.

    (Or: You may want to run some of the code from SRAM, if it needs to run extra fast)

    -See "Using GNU Assembler" for more information about what it can do.

  • Hi jensbauer

    Sorry for the latency

    How can I add M0 image(Hex file) to M4 project?

    Can you please explain how to do that in assembly?

    Thank you

Reply Children
More questions in this forum