Question

Currently I'm making the step to upgrade my spare-time projects to the use of an ARM instead of the 8bit micros from Microchip.

But unfortunately I ran into some problems:

I do not really understand the differences in ways of programming: - programming into ROM - programming into RAM (which is only 32K in my case)

I already did some "hello world" tests with the IAR IDE where the compiling/programming was done with a given configuration I didn't worry about. But I didn't like the IAR IDE and the 32K limit of the IAR compiler so I decided to set up a new environment (see configuration below).

After setting up the Eclipse environment, using the examples provided by IAR I managed to program the ARM into RAM. But when I wanted to program the ARM to ROM the program doesn't seem to do anything. I used example makefiles which I believe did some sort of mapping to ROM or RAM, I only had to define one of them each time.

I know that ROM is read-only memory and wont be empty after the power has been disconnected and RAM is faster but requires the program to be downloaded to the ARM each time.

Do I need to devide my program into parts of ROM and RAM, or can I program everything to ROM in a way that the ARM will remap the code to RAM when it is powered up?

Currently I am using the following configuration:

  • Codesourcery GCC
  • Eclipse C/C++
  • Segger Jlink programmer (GDB server)
  • CMSIS or LPCOpen library (not completely working yet)
  • NXP LPC1766 Cortex M3
  • Windows 8 64-bit
  • IAR examples for LPC1768 and CMSIS
  • examples from NXP: lpc17xx.cmsis.driver.library

Could someone please help me understand the different uses of ROM and RAM and how I should set up my compiler/makefiles to make use of the ROM and RAM memory.

In the end I want to be able to program the ARM (I think) into ROM in a way that I can power-off the ARM without having to reprogram it each time.

Was it helpful?

Solution

I think you need to look at the linker map files provided with the examples. These files will have a .ld extension and often you will see the letters RAM or ROM or Flash in the file name. The linker file is just a text file so you can examine it in the Eclipse editor. The important part is that the .text section is located in the ROM.

The launcher for the GDB will also have a startup script associated with it. You can edit this using the Configure... choice under the same Eclipse menu item that starts GDB. The script needs to end with lines like

monitor flash device = LPC1343
monitor flash download = 1

The monitor command in GDB sends the rest of the line to the GDB server. The flash commands are explained in the JLink GDB server manual.

EDIT: The .text section is the default section used by the linker for executable code. In my gcc_arm.ld file I have this:

SECTIONS
{
    .text :
    {
        KEEP(*(.isr_vector))
        *(.text*)

    } > FLASH

I put the reset and interrupt vectors in their own section and force the linker to put those at the very beginning of the executable code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top