This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Program skipping reset handler and system init in .s file right to a logging function

Hello,

To my understanding, normally, either after a reset or powering up, the program should first run to Reset_Handler, then SystemInit, then __main.

Somehow, my program runs to none of the places above, and if you F11 all the way down (I'm using keil uv5), it will eventually hit this function:

uint32_t log_vprintf(uint32_t dbg_level, const char * p_filename, uint16_t line,
    uint32_t timestamp, const char * format, va_list arguments)
{
    uint32_t status = NRF_SUCCESS;
    if(m_log_callback != NULL)
    {
        status = m_log_callback(dbg_level, p_filename, line, timestamp, format, arguments);
    }

    return status;
}

(I'm trying to port the provisionee program of BLE Mesh to my board, and this is a module called "log.c" BTW. )

Or if you hit F5 on keyboard and let it run, it will go through none of those function (I set breakpoints there), and eventually stop at here, which is a random place by the look of it:

image description

And this is what it looks like at address 0x633abb86:

image description

Any idea how to approach this problem?

Edit: here's the project file, including the official program files and the softdevice which I'm using (S140 alpha 1):

Extract to a directory in F.7z

Extract it to a directory in F: with the name "BLE Mesh Official" and you should be good to go. Otherwise you may need to spend some time doing the inclusion path modification in the magic wand.

  • @endnode Can you shed some light? I haven't the faintest idea how to deal with this. Line by line I walked through the first 80? or so assembly codes but none of them made any sense. I also got a 0xCAFEBABE return code of some sort in r3 register but I have no idea who returned it.

  • I'm not sure what is going on. Could you share your complete project so I can test it here? Which SDK and SoftDevice are you using? What kind of hardware?

  • @Mitch996 sorry buddy, would like to help but I don't use Keil and I don't believe in debugger F5 or Fwhatever magic on embedded systems;) I just use GCC and never had problems to reach first line in main on nRF5x firmwares. Which just says I'm dinosaur to be smashed by all these young guys mastering new fancy tools and methods... as soon as they boot the chip;) Or if they boot it (sorry, I know, not relevant, not helping... at least some humor to your depressing Thursday?:)

  • @Petter Myhre Not a problem! It's not "my project" per se, it's "Your" project actually, well, the BLE Mesh release, I'm just someone who is trying to clumsily port it to my PCA10056 nrf52840 board. It's the light control provisionee example program, the provisioner appears to be working fine, I altered some file and bah lah bing! It's the provisionee program (since provisioner and provisionee share like >90% of the files). I'll try to attach a compressed file here, somewhere...

    Oh and be careful, the project is kind of messy. Also, please Nordic, next time you release something, please please get a keil-enabled version ready. You would save us a ton of work load.

    Edit: Project directory compressed and attached, awaiting your replies, thank you!

  • @endnode nah it's OK, I should have thought about that you are on the money-smart path. Anyway I'll stick to keil even though it's nowhere near perfect... I'm lazy. Thanks all the same man!

Related