36 votes
Accepted

Can abstractions and good code practice in embedded C++ eliminate the need for the debugger?

I think you are misrepresenting the message of the "Modern C++ in Embedded Systems" video. The point is that there are people in the embedded world that write code and then test it by running the code ...
henje's user avatar
  • 454
35 votes

Can abstractions and good code practice in embedded C++ eliminate the need for the debugger?

No, not at all ! Abstractions and good practices can of course reduce the risks of errors. For example: language abstractions let the compiler generate code, that you would have to write yourself ...
Christophe's user avatar
27 votes
Accepted

An older, experienced contractor used an SQLite DB for various queues - am I, a young dev, justified with feeling uncomfortable with it?

Your first problem is that you think of the design as "wrong." That's really not the right way to consider things. Rather, different designs make different design trade-offs. Any design has pros and ...
Winston Ewert's user avatar
22 votes

Can abstractions and good code practice in embedded C++ eliminate the need for the debugger?

This question basically boils down to "can you write bug free code the first time every time?” The answer is always going to be no. Yes, there are practices that can help, you can isolate modules. ...
whatsisname's user avatar
  • 27.7k
21 votes
Accepted

Code development process for Voyager mission?

(Edit: 12/7/2017, a year later, I found an authoritative answer) In an article on software development for NASA space missions. https://www.nasa.gov/pdf/418878main_FSWC_Final_Report.pdf On page 31, ...
BenPen's user avatar
  • 514
16 votes
Accepted

Group set of commands as atomic transactions (C++)

In practice, such atomic transactions do not exist. Instead, you can try to make all operations idempotent so that they can be safely retried. Idempotence is particularly important for network ...
amon's user avatar
  • 134k
15 votes

Code development process for Voyager mission?

This article in Wired makes it clear that the code was written in Fortran 5 and later ported to Fortran 77 and some elements are now in a version of C: The spacecrafts’ original control and ...
Brian Tompsett - 汤莱恩's user avatar
13 votes
Accepted

Dealing with global variables required by badly-written library

Assuming that you cannot change the library, and you have to use it, you need to have these global variables somewhere in your code. I’d recommend implementing an interface module that the rest of ...
gnasher729's user avatar
  • 44.7k
11 votes

How to deal with a lot of conditions in If statement in an elegant manner

If you refuse to abstract or change usart_error then consider using whitespace to take mercy on my eyes. if ( usart_error.CRCError || usart_error.DMATransferError || usart_error....
candied_orange's user avatar
10 votes

Can abstractions and good code practice in embedded C++ eliminate the need for the debugger?

There are two basic types of software bugs: The code doesn't do what you intended. What you intended was the wrong thing to do. The choice of languages etc may (or may not) have an impact on the ...
alephzero's user avatar
  • 1,269
10 votes

An older, experienced contractor used an SQLite DB for various queues - am I, a young dev, justified with feeling uncomfortable with it?

I think you are making a common junior-level programmer error in your judgement here. Because the solution is not the way you would have done it, you want to redesign it. One of the most important ...
JimmyJames's user avatar
  • 27.1k
9 votes
Accepted

Is there a drawback at allocating a huge amount of the stack for a single array in an embedded system?

The only thing I'm conscious is that I have to make sure I actually have 1KB of stack free when entering this function. Yes, and that is a strong constraint. You'll better be sure statically than you ...
Basile Starynkevitch's user avatar
9 votes

What is the simplest OS or platform upon which we can do SE today

What is the simplest operating system or platform upon which we can do Software Engineering in this day and age? None. One of the main activities in Software Engineering is conceptual software ...
Doc Brown's user avatar
  • 207k
8 votes
Accepted

Different ways to distribute (embedded) C modular library

Generate .a file Build a (web-based) library generator (again one .c and .h file) Neither of these is a good option. The former is, for the reason you covered, platform-specific. The latter ...
Blrfl's user avatar
  • 20.4k
8 votes
Accepted

Static vs non-static in embedded systems

This is actually the worst thing to do because you never know what resources will be needed in all cases meaning that your code can crash in the real world when it was fine in tests. It also means ...
Steve Barnes's user avatar
  • 5,300
7 votes

Using nested classes to modularize large application code?

Immediate questions are: Are TCP sockets and HTTP connections really specific to your Manager::Transport nested class? How will you unit test them if they're not accessible outside Manager? Will ...
Useless's user avatar
  • 12.6k
7 votes
Accepted

Embedded Systems: Designing an API that monitors an address

Critical importance here is context of interview for a semi conductor company without knowing the role description, therefore this is impossibly broad. Jumping into code with the information provided ...
mattnz's user avatar
  • 21.3k
7 votes
Accepted

TDD - What to do when adding a new function on a dependency causes many previous tests to fail?

Me and lot of others are heavily against using Mocks. We consider mocks as sign of bad design and testing practice. What you describe is one of the reasons why. Mocks couple test way too tightly with ...
Euphoric's user avatar
  • 37.3k
6 votes

Is there a drawback at allocating a huge amount of the stack for a single array in an embedded system?

People tend to be cautious with a large stack, because it grows backwards in RAM and overwrites values of variables, leading to unexplainable behavior. It gets even worse, because you need to know the ...
Martin Sugioarto's user avatar
6 votes

How do you adapt to changes to product specifications during development?

Your parser approach is definitely a step in the right direction. To deal with what you describe, you need to follow two well known software engineering principles as rigidly as possible: 1. Single ...
Doc Brown's user avatar
  • 207k
6 votes

Handling out of bounds requests in embedded C library

since we're implementing our own error code, the caller has to actively remind themselves to to check this value, making it easy to miss. Why not design the API in a way it becomes hard for the ...
Doc Brown's user avatar
  • 207k
6 votes

What is so different about RTOS compared to normal programming?

By not treating all Interrupt Service Routines (ISR's) as the highest priority. The kernel of an RTOS is preemptible where as a GPOS kernel is not preemptible. This is a major issue when it comes to ...
candied_orange's user avatar
6 votes

Appropriate way to handle timezone for embedded/IoT devices

IGNORE THE TIMEZONE OF THE DEVICE Report your answers in UTC. In almost ANY situation where you are displaying or reporting on time based data, the timezone of interest will NOT be the timezone ...
Lewis Pringle's user avatar
6 votes
Accepted

How to deal with a lot of conditions in If statement in an elegant manner

If usart_error is your own class, you should add methods with descriptive names to it so that you can write these conditions not just shorter, but more intellegibly. For instance, .transient_error() ...
Kilian Foth's user avatar
6 votes

Is it possible to write unit tests for embedded systems with no prior embedded programming knowledge?

I had been programming embedded systems for a while. I think the key thing you need to write good unit tests for embedded systems is that you need to have a clean interface for accessing hardware. If ...
Ken Hung's user avatar
  • 188
6 votes
Accepted

What is AUTOSAR? Is it a file structure?

Autosar is a standardization initiative for software architecture in the automotive industry, and more precisely in the field of Electronic Control Units, which are all theses computing devices ...
Christophe's user avatar
6 votes
Accepted

How to propagate parameters through several architectural layers?

I think the design smell is here that you are planning to use a huge global object (or component) with mutable state. That is an invitation for all kind of errors and can cause maintenance headache. ...
Doc Brown's user avatar
  • 207k
5 votes
Accepted

SPI vs SCI on TI processor

SCI is not a standard term. Usually it's called a UART, and that's the interface you would use to communicate between the dev board and the PC. SPI is used for communication between chips on a board,...
Karl Bielefeldt's user avatar
5 votes
Accepted

Dealing with a variable that is a number, but has greater meaning?

Numbers with limited range arise often enough that (IMO) it's worthwhile adding a type specifically to handle them. I've used something on this order quite a few times: template <class T, T lower, ...
Jerry Coffin's user avatar
  • 44.5k
5 votes
Accepted

How do you use use cases in a driver design with interrupts?

The system under consideration in your model seems to be your microcontroler with your driver. The actors interact with this system under consideration. They are of two kinds : primary actors: ...
Christophe's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible