1

I am unit testing embedded code on a host environment (vectorcast).

The code is devloped using an arm-eabi compiler on the target hardware. We are testing it on desktop without any simulator or hardware interface.

I am using mingw - 4.5 gcc compiler. Often there is are lot of assembly code in header files like:

__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
{  uint32_t result;   

__ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) );

return(result);}

While testing my source unit say x1.c, it calls a function like defined above in an included header file. When I try compiling this, I get the following error:

Error: no such instruction: `rbit %ebx,%eax'

Is there any gcc switch that when used for options, ignores code prefixed with __asm?

Any other solution is also welcome.

yash
  • 19
  • 2
  • Do you really want to randomly remove code from your functions for unit testing? Doesn't sound like a good idea... I wonder how you want to unit test code on such a low level without using or simulating the hardware... – andreee Jun 07 '18 at 11:48
  • hi Andreee, we are an offshore team, we dont have access to the target hardware. Anyway, I am unit testing a single source, and stubbing called functions. These asm libraries are shipped with the hardware , and perhaps object code analysis happens at a later stage in which I am not directly involved – yash Jun 07 '18 at 12:04
  • It sounds as if you are being asked to perform a task without being properly equipped. Can your team not make a request for an emulator? Another approach would be to create your own emulator based on specs of hardware/software you are testing. But I agree with earlier comment, it is _not_ a good idea to ever change the thing you are testing, or to avoid looking at (ignore) the thing you are testing to avoid seeing the results just to get a pass. – ryyker Jun 07 '18 at 12:59

0 Answers0