ARM Technical Support Knowledge Articles

ADS 1.1: Scatterloading of mixed ARM and Thumb projects with CodeWarrior

Applies to: ARM Developer Suite (ADS)

Answer

The CodeWarrior IDE offers an "Thumb ARM Interworking Image" project template which you can use to create a mixed ARM/Thumb project. This creates a Thumb project containing an ARM sub-target. In ADS 1.1 and earlier, the ARM objects are partially-linked into a single object in the sub-target, and it is this partially-linked object that is linked with the Thumb objects into the final image.

Unfortunately, this mechanism means that it is not possible to place the ARM objects individually using a scatter description file. The partially-linked object loses the original object names (and entry points), and so the link step will fail if you attempt to specifically place such objects.

This does not occur with ADS 1.2, which uses a different mechanism ("directory of objects").

To avoid this problem with ADS 1.1 and earlier, we recommend the creation of a new Interworking project stationery, which uses a flat file build hierarchy (instead of sub-targets), and mark Thumb C source files with (e.g) a '.tc' extension. The recommended method to do this is:

1) Create a new project based on an ARM Executable Image.

2) Add all your source files (we will rename some .c files to (say) .tc later)

3) Use Edit->DebugRel Settings

4) Select File Mappings in DebugRel Settings dialog

5) Select the line "TEXT .c ARM C Compiler"

6) Edit the Extension: field from '.c' to '.tc'.

7) Select "Thumb C Compiler" from the "Compiler:" dropdown list.

8) Press ADD button.

9) Select ARM C Compiler (in Language Settings tree), ATPCS tab.

10) Check ARM/Thumb Interworking checkbox (or type -apcs /inter in Equivalent Command Line field and press Enter) and then SAVE.

11) Select Thumb C Compiler (in Language Settings tree), ATPCS page.

12) Check ARM/Thumb Interworking checkbox (or type -apcs /inter in Equivalent Command Line field and press Enter), and then SAVE.

(repeat the above steps for Debug Settings and Release settings, and for the C++ compilers if you need them).

13) In the project view open any files you wish to be compiled for Thumb, and use File->Save As to rename them as file .tc. This will automatically change the reference in the project to match. (to avoid this feature you should use File->save a copy as..)

14) We recommend adding '-info veneers' for Debug, DebugRel and Release targets into the ARM Linker, and then saving the project as stationery. See Online Books IDE Guide, section 2.4.3, "Creating your own project stationery."

One limitation of this approach is that File->Open with type Source Files does not show your .tc files. This is unfortunately hardwired within CodeWarrior. Beware also that any existing external references to Thumb .c files (e.g in a Version Control tool) which have become .tc files will be affected.

However, there are a number of advantages:

1) The browse data is shared between ARM and Thumb (this is not the case with interworking template which uses ARM subtarget).

2) No partial link

3) No subtarget output chaining.

4) No additonal "emptyarm.c" is created for empty sub-targets.

Article last edited on: 2008-09-09 15:47:28

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential