This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: Compiled MSPBSL On ARM and found bug on UartComm

Part Number: MSPBSL
Other Parts Discussed in Thread: MSP430G2553,

I've implemented a custom BSL bootloader for a project based on MSP430G2553 and BSL works flawlessly on a Windows PC using a UART link. Then I've managed to compile the BSL Scripter on a Linux-based ARM device (ODROID C2 and XU4) and it fails badly.

I've tracked down the issue and found out that many variables used on UartComm::receiveBuffer() are updated asynchronously, but aren't declared volatile. On x86 CPU this is rarely an issue since they don't have many registers for optimization and access of all data tends to use RAM, but this is not the case on optimized ARM code. So the read loop fails badly.

As I don't know the inner working of all the boost stuff I've made a superficial analysis to solve that: I've put a volatile on the declarations of variables timerEvent, actSize, expSize and bytesReceived of the UartComm and now it works flawlessly.

Maybe one should make a in-depth analysis and publish an update to this source code, specially regarding the use of volatile, since I've found situations where it is unnecessarily used in synchronous code and missing, as I already stated, on asynchronous code.

Best Regards,

Mathias Gruber

  • Hello Mathias,

    Thanks for your detailed post. According to our MSPBSL page, the BSL-SCRIPTER does support Linux, but I'm assuming that support is for x86 architectures and not ARM architectures, especially considering the issues you observed on ARM. From a support standpoint, that makes sense to me because most developers will probably use their PC. However, some users like yourself may use an Odroid or RPi. I'll pass along your feedback to our software development team to make them aware of this issue. While it's doubtful that we could validate BSL-SCRIPTER across all ARM devices, we do have Sitara processors that are ARM-based that could be used.

    What flavor of Linux were you running on the Odroid?

    Regards,

    James

    MSP Customer Applications
  • Hi James,

    I am happy to here your news and willing to help with the quality of the tool.

    I've tested the code on Ubuntu Xenial (Odroid C2) and Debian 9 (Odroid XU4).

    I've also found that the timeout set for this read loop a bit to tight (1000 ms), specially for the case of a mass erase command, Which may timeout before the response is ready. More problematic is when it occurs before the response packet terminates and communication get out of rails causing a real disaster.

    Best Regards,

    Mathias

**Attention** This is a public forum