[SOLVED] hardfault just on start

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] hardfault just on start

    I build an example start from the strat example and take in some part of the fds_fstorge from Nordic. It build after some modifications
    I create two task and init the OS and HW. The main is as standard as this
    int main(void) {
    OS_Init(); // Initialize embOS
    OS_InitHW(); // Initialize required hardware
    OS_TASK_CREATE(&TCBFS, "FS Task", 50, MainTask, StackFS);// the File System task
    OS_TASK_CREATE(&TCBNOR, "NOR Task", 100, NorTask, StackNOR);// the ex NOR direct handling task
    NRF_LOG_INFO("embOS OS_FileSystem example");
    NRF_LOG_INFO("\n\nDemonstrating Qspi DMA use\n");
    OS_Start(); // Start embOS
    return 0;
    }

    When run it after the OS_Start it fail on hardfault. Didn't even get to start of the first task. When I omit the second task it get to the first function in the first task and then fail. When I omit the first task it getto the first function of the second task and fail. As I look in the HardFault_handler and from what I read it is look it has Bus fault like memory error. I couldn't get it to go out of the hatdfault_handler by set _Continue =1;
    When I compare it to other examples with the some setting on start it run there.
    It is look to me that something happened with it memory or stack arrangement, but I don't know where to look it for.
    1. Any clue how can I get more data from the hardfaultHandler (attach screen shot with the relevant register values open on the right) ?
    2. Which file can be check for this problem?
    Thanks
    Bar.
    Images
    • hardfault window.png

      247.58 kB, 1,920×1,080, viewed 1,727 times
  • Hello,

    is it possible to share your complete project with us?
    With the project it should be possible to solve your issue within a few minutes.
    If not could you please show how StackFS and StackNOR are defined?
    What else did you change in the project?

    Regarding hard fault, please have a look here in the application note: Analyzing HardFaults on Cortex-M CPUs (AN00016)

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi.
    I didn't change any of the original files just add some. But I made some changes in the xml file which could effect.
    The StackNOR and StackFS define as the TaskHP, TaskLP. I also try to change there size and priority.
    Because it fail on start it look to me that something in the memory usage is wrong.
    I send you a link to the project.
    Bar.