Home > On-Demand Archives > Talks >

Embedded Software Programming Rules, Tips and Tricks

Jean Labrosse - Watch Now - EOC 2023 - Duration: 28:53

Embedded Software Programming Rules, Tips and Tricks
Jean Labrosse
In this class, I will provide some of my favorite Embedded Systems Programming rules, tips and tricks. Specifically, I’ll cover some good design, coding and optimization techniques as well as things that will improve the overall quality of your code. Finally, I will also provide references to must have books.
M↓ MARKDOWN HELP
italicssurround text with
*asterisks*
boldsurround text with
**two asterisks**
hyperlink
[hyperlink](https://example.com)
or just a bare URL
code
surround text with
`backticks`
strikethroughsurround text with
~~two tilde characters~~
quote
prefix with
>

AlessandroDePin
Score: 0 | 2 years ago | 1 reply

This video contains precious pearls: it's a clear explanation of good software practices. Thanks a lot for your work and passion!

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

Thank you for your kind words.

Rick_D
Score: 0 | 2 years ago | 1 reply

Thanks for your insights. I particularly liked the Global/extern tips/trick

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

You are welcomed.

Kornak.ca-DevServices
Score: 0 | 2 years ago | 1 reply

Why is it that you advise against macros that invoke other macros? What are some downsides that you see in this practice? I've long used macros that invoke other macros for the purposes of abstracting mathematical operations (i.e #define TIMER_TICKS_PER_MSEC (TIMER_TICKS_PER_SEC / 1000) ), and have found the practice highly beneficial. Might there be some situations where it is a good idea to implement macros which invoke other macros? What is a situation or example where it is a bad idea to implement a macro which invokes other macros?

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

Well, I dont have an issue when a macro (code) includes another macro (constant). I have an issue when a code macro includes another code macro and worse yet, when that invokes another code macro!
Also, Iève seen a macro that was 30+ lines of code and included local labels and gotos.
I prefer using inline functions to complex code macros.

Scott.Becker
Score: 0 | 2 years ago | 1 reply

Hi Jean, thanks for the great talk. I have a question about Rule #8 on slide 14. In that part of the presentation you were advocating for adding extra spaces to make the code line up. I agree that it does make the code easier to read, but in my experience it also makes it harder (more time) to maintain. Do you have any thoughts on that balance, particularly as it pertains to this rule? Thanks.

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

Scott, thanks for your question. Well, I realize that it's harder to maintain but for me, it's worth the effort. Also, some editor have 'column mode' where you can highlight a column of text and add spaces in that column or delete spaces. That's a feature I requested to be added in IAR's Embedded Workbench (which they did) and it makes life so much easier to shift left or right columns. I used to use CodeRight years ago which had that feature. I'm sure other editors have it too.

Thomas.Schaertel
Score: 0 | 2 years ago | 1 reply

Hi Jean, like always a great talk. Those great and practical insights help a lot for clean code. Thanks a lot!

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

Thank you Thomas.

AliceWang
Score: 0 | 2 years ago | 1 reply

Clear and straightforward talk! Thank you!

JeanLabrosseSpeaker
Score: 0 | 2 years ago | no reply

Thank you, I'm glad you liked it.

SimonSmith
Score: 1 | 2 years ago | 1 reply

It's always a pleasure reading the uC/OS-III code when debugging. The API is very consistent. Did you format the code and the function header comments all by hand throughout, or use a tool to enforce it? I find even when we have a coding standard, everyone's style is still ever so slightly different.

JeanLabrosseSpeaker
Score: 1 | 2 years ago | 1 reply

Thanks for the kind words. All formatted by hand. There was nothing at the time that I was satisfied with to do it automatically.

SimonSmith
Score: 0 | 2 years ago | no reply

It’s a great RTOS that I enjoy working with in my day job. I get the feeling that it’s a much less popular choice nowadays. I tried uC/FS with it (mainly because of the wear levelling), but struggled with it. So if you’re looking for inspiration for next year’s talks, anything Micrium-related would be good!

OUR SPONSORS

OUR PARTNERS