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

__main is going in hardfault

I am working on Cortex M0+ controller. Following is issue i am facing in __main library function.

While executing library function __main (Keil compiler internal fucntion for initializatioin data and bss section) code is going in hardfault.
If any one has solution for this please let me know.

Parents
  • I have verified scatter file it has correct address for ROM and RAM. I have debugged further in __main and found that if I give RAM start address 0x20000000 its going in hardfault in decompression(There is wrong calcualtion of address).
    If I give RAM start address 0x20000100 to eliminate wrong calcualation in decompression, __main is not going in hardfault but then .data and .bss section initialization is wrong. Here is my scatter file...

    LR_IROM1 0x00000000
    { ; load region size_region ER_IROM1 0x00000000 0x00040000 { ; load address = execution address startup_ARMCM0plus.o (RESET, +First) * (InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000100 0x00008000 { ; RW data .ANY (+RW, +ZI) }
    }

Reply
  • I have verified scatter file it has correct address for ROM and RAM. I have debugged further in __main and found that if I give RAM start address 0x20000000 its going in hardfault in decompression(There is wrong calcualtion of address).
    If I give RAM start address 0x20000100 to eliminate wrong calcualation in decompression, __main is not going in hardfault but then .data and .bss section initialization is wrong. Here is my scatter file...

    LR_IROM1 0x00000000
    { ; load region size_region ER_IROM1 0x00000000 0x00040000 { ; load address = execution address startup_ARMCM0plus.o (RESET, +First) * (InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000100 0x00008000 { ; RW data .ANY (+RW, +ZI) }
    }

Children