Electronic – Embedded Firmware Question – Memory dump

embeddedfirmwarememorymicrocontroller

Ok so the back story is this. I landed an online code interview with a company that shall remain nameless.

I know I am not ready for a job there but I was basically given the chance by an insider. Anyways below is a picture of the question.

I have experience doing register programming and dealing with micro-controllers, but all of this is on my own so I have never seen "real industry up-to-standard code" so to speak. I most definitely have never dealt with any "memory dump" from a micro-controller , because well I have never had such bug or even knew it could do that…

My question is two fold.. first is the questions in the picture… if anyone can answer them…. and my other question is…if a micro-controller fails or something goes wrong and it stops working then how does it do a memory dump? seems to me that it would require it to be in working order to execute something like that. otherwise youll just get the memory dump of what things looked like "before" the crash.
enter image description here

enter image description here

Best Answer

The memory dump in question was not taken at crash. It was taken for debuging. A memory dump 'at crash' is created for a software error (exeption) detected at runtime by the program or debugger.

The question is simple. The 'dump' contains a memory occupied by an instance of the struct packet_S. You need only interpret the bytes into data types of member variables. And the struct is very simple. It takes 1 + 2*2 + 4 bytes.

The content of the struct starts at 0x1010 so count is 0x6F. This is not affected by 'endianes'. The ints and the long are affected by byte ordering, so you need to interpret them for A and B.