We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,everyone ,I'm trying to access my function using its absolute address.It works when I debug it in KEIL step by step,but it jump to hard fault when runs. my code is as below:
ptr=(int(*)(int))0x240; //0x240 is the address my function locates. c=ptr(2);
And I've also met a very similar problem.The program jumps to hard fault when I have function(placed in a single file)placed in a special section .And the placement is fulfilled by sct file like this(fsk_tx.c):
; *************************************************************
LR_IROM1 0x00000000 0x00008000 { ; load region size_region ER_IROM1 0x00000000 0x00007000 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO)
} ER_ROM 0x00007000 0X1000 { fsk_tx.o } ER_RAM 0x1FFFFB00 0X100 {
} RW_IRAM1 0x1FFFFD00 0x00000300 { ; RW data .ANY (+RW +ZI) } RW_IRAM2 0x20000000 0x00000C00 { .ANY (+RW +ZI) *(runinram) } }
And the program works if I comment the fsk_tx.o in the sct file.
I'm really puzzled about it ,and I have to make it work soon. Thanks !
I can't see anywhere that the chip in question - or even the core in question - has been mentioned but, if it's a Cortex-M, take a look at the links & info here:
community.arm.com/.../5414
Covers Cortex-M0, Cortex-M0+, Cortex-M3, Cortex-M4
Hi,the core is ARM cortex_m0,and the chip is freescale's KL serials. I scanned the linked page,not understand full.I think they are telling how to locate the hard fault.It may be help,but can I ask if my problem is result from executing code from ram? actually I also want to know why it jumps to hard fault when I locate function in special session,like a session in flash? I think the crash has similarity with my coping code from flash to ram and running it. Am I on the right way to solve the problem?Thanks !