1
votes

In my current project we are using Segger embOS as an RTOS. The target system is an ARM Cortex-M MCU

The RTOS has some code written in assembler. However the ASM code produces an error:

RTOS.s:69: Error: bad instruction `end'

According to the ARM assembler reference guide http://infocenter.arm.com/help/topic/com.arm.doc.dui0489f/DUI0489F_arm_assembler_reference.pdf

(Chapter 6.8.5) the instruction "END" exists (I'm not sure if assembler is case sensitive) although this instruction exists, the assembly won't compile.

Each of the includes files terminate with an .end (note the "." and the lower case letters)

File RTOS.s


#define OS_RTOS_S_INCLUDED

/*******************************************************************
*
*       Code section includes selected code
*
********************************************************************
*/
#if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__)
  //
  // Cortex-M0
  //
  #include "RTOS_CM0.S"

#elif (defined (__VFP_FP__) && defined (__SOFTFP__))
  //
  // Cortex-M3 or Cortex-M4 without VFP
  //
  #include "RTOS_CM3.S"

#elif (defined (__VFP_FP__) && !defined (__SOFTFP__))
  //
  // Cortex-M4 with VFP
  //
  #include "RTOS_CM4F.S"

#else
  #error "No RTOS.S for selected CPU available, check configuration"
#endif

/********************************************************************/

        END//Line 69

/*****  End of file  ************************************************/

Switch the END to .end seams to resolve the compile error. However the function defined in the assembler script are not found by the linker (this could be different problem though)

So my question is: Why is the instruction END a bad instruction?

1
Which assembler do you use to assemble this? The GNU assembler uses a different syntax for assembler directives than the ARM assembler.fuz
i'm using gcc 4.8. So the assembler is the GNU assembler.JHeni
Then you either need to patch the assembler sources to follow GNU assembler syntax and semantics or your need to switch to the ARM assembler for these files.fuz
I'd prefer not to modify the assembler file since it is not written by me. How do i switch to the arm assembler? Is this done by passing -mthumb or -marm to the gcc?JHeni
You have to get a copy of the ARM assembler from somewhere and then adjust your build scripts to pass the ARM assembly files through it instead of the GNU assembler. The ARM assembler is not open source software as far as I know.fuz

1 Answers

0
votes

The END directive is an armasm directive, not an ARM assembly instruction. That is to say it is an instruction to the assembler during the build of the code, not an instruction to the processor. .end is the GNU as (GNU assembler) equivalent.

Different toolchains use different assembler directives and syntax. You are trying to build the armasm source code using gas (GNU assembler) which is not compatible. You will certainly encounter other issues than this that will prevent you building ARM toolchain specific source code/object with the GNU toolchain - not least, apart from the technical issues, there are legal issues given that embOS licences are toolchain specific.

Each Segger embOS license is provided for a specific toolchain. If you wish to use a different toolchain you will need a new license and different toolchain specific code/library - even if you have a source code licence; it is not just a legal issue but a technical one - Segger do not provide the code for all toolchains with a license for a single toolchain. If you only have an object code licence, it may not link if using a different toolchain (or in some cases even different toolchain version) than the object code was built with.

You need to check, but it is likely that you have a licence for the Keil ARM MDK toolchain (which includes armcc/armasm etc.). It is not a free tool one way or another you need to either purchase an embOS licence for GNU, or licence to the toolchain you have the embOS licence for.

You might do well in any case to update your Segger support and maintenance licence in any case, so you can get technical support from them.