Skip to content

User data is not saved #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
riwalker opened this issue Feb 1, 2023 · 3 comments
Open

User data is not saved #6

riwalker opened this issue Feb 1, 2023 · 3 comments

Comments

@riwalker
Copy link

riwalker commented Feb 1, 2023

I had to make 2 changes:

    • add the passed user data 'reset_type'
      CApplicationMonitor::CApplicationMonitor(int nBaseAddress, int nMaxEntries)
      : c_nBaseAddress(nBaseAddress), c_nMaxEntries(nMaxEntries)
      {
      m_CrashReport.m_uData = reset_type;
      }
  1. Write the userdata with memcpy
    void CApplicationMonitor::WatchdogInterruptHandler(uint8_t *puProgramAddress)
    {
    CApplicationMonitorHeader Header;

LoadHeader(Header);
memcpy(m_CrashReport.m_auAddress, puProgramAddress, PROGRAM_COUNTER_SIZE);
//RIW fix to write the user data
memcpy(m_CrashReport.m_auAddress+PROGRAM_COUNTER_SIZE, &reset_type, PROGRAM_COUNTER_SIZE);
SaveCurrentReport(Header.m_uNextReport);

@PaulMartinsen
Copy link
Collaborator

That sounds like a good improvement, but I'm not sure where reset_type comes from. Any chance you could do a pull request so we can incorporate your changes?

@riwalker
Copy link
Author

riwalker commented Feb 2, 2023 via email

@riwalker
Copy link
Author

riwalker commented Feb 2, 2023

Any advice why integrating other code using USART Interrupts, that the combo of this code causes a death of the micro - I guess its stuck in bootloader
The program actually locked in downloading new code over USB-Serial on Leonardo, so assume the code download was longer that the WDT period (set at 4s) ? so the code half-loaded ? now the bootloader is damaged and cannot load new code ? or stuck in an infinite loop ?
appreciate your advice, stuck...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants