1 2 3 4 5 6 7 8 9 10 11
12 import xdc.bld.ITarget2;
13
14 /*!
15 * ======== M3.xdc ========
16 * Embedded little endian Cortex M3 bare metal target
17 *
18 * This module defines an embedded bare metal target on Cortex M3. The target
19 * generates code compatible with the "v7M" architecture.
20 *
21 */
22 metaonly module M3 inherits gnu.targets.ITarget {
23 override readonly config string name = "M3";
24 override readonly config string suffix = "m3g";
25 override readonly config string isa = "v7M";
26 override readonly config xdc.bld.ITarget.Model model= {
27 endian: "little",
28 codeModel: "thumb2",
29 shortEnums: true
30 };
31
32 override readonly config Bool alignDirectiveSupported = true;
33
34 override readonly config string rts = "gnu.targets.arm.rtsv7M";
35 override config string platform = "ti.platforms.stellaris:LM3S9B90";
36
37 override config string LONGNAME = "bin/arm-none-eabi-gcc";
38
39 override readonly config String stdInclude = "gnu/targets/arm/std.h";
40
41 override readonly config ITarget2.Command cc = {
42 cmd: "$(rootDir)/$(LONGNAME) -c -MD -MF $@.dep",
43 opts: "-mcpu=cortex-m3 -mthumb -mabi=aapcs -g"
44 };
45
46 readonly config ITarget2.Command ccBin = {
47 cmd: "bin/arm-none-eabi-gcc -c -MD -MF $@.dep",
48 opts: "-mcpu=cortex-m3 -mthumb -mabi=aapcs -g"
49 };
50
51 override config ITarget2.Options ccOpts = {
52 prefix: "-Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections",
53 suffix: "-Dfar= -D__DYNAMIC_REENT__ "
54 };
55
56 /*!
57 * ======== ccConfigOpts ========
58 * User configurable compiler options for the generated config C file.
59 */
60 override config ITarget2.Options ccConfigOpts = {
61 prefix: "-Wunused -Wunknown-pragmas -ffunction-sections -fdata-sections",
62 suffix: "-Dfar= -D__DYNAMIC_REENT__ "
63 };
64
65 override readonly config ITarget2.Command asm = {
66 cmd: "$(rootDir)/$(LONGNAME) -c -x assembler-with-cpp",
67 opts: "-Wa,-mcpu=cortex-m3 -Wa,-mthumb"
68 };
69
70 readonly config ITarget2.Command asmBin = {
71 cmd: "bin/arm-none-eabi-gcc -c -x assembler-with-cpp",
72 opts: "-Wa,-mcpu=cortex-m3 -Wa,-mthumb"
73 };
74
75 override config ITarget2.Options lnkOpts = {
76 prefix: "-mthumb -march=armv7-m -nostartfiles -Wl,-static -Wl,--gc-sections",
77 suffix: "-Wl,--start-group -lgcc -lc -lm -Wl,--end-group -Wl,-Map=$(XDCCFGDIR)/$@.map -L$(XDCROOT)/packages/gnu/targets/arm/libs/install-native/$(GCCTARG)/lib/armv7-m"
78 };
79
80 readonly config ITarget2.Command arBin = {
81 cmd: "bin/arm-none-eabi-ar ",
82 opts: ""
83 };
84
85 86 87
88 override config xdc.bld.ITarget.OptionSet profiles[string] = [
89 ["debug", {
90 compileOpts: {
91 copts: "-g",
92 defs: "-D_DEBUG_=1",
93 },
94 linkOpts: "-g",
95 }],
96
97 ["release", {
98 compileOpts: {
99 copts: " -O2 ",
100 },
101 linkOpts: " ",
102 }],
103 ];
104
105 106 107
108 override config String compatibleSuffixes[] = [];
109
110 override readonly config xdc.bld.ITarget.StdTypes stdTypes = {
111 t_IArg : { size: 4, align: 4 },
112 t_Char : { size: 1, align: 1 },
113 t_Double : { size: 8, align: 8 },
114 t_Float : { size: 4, align: 4 },
115 t_Fxn : { size: 4, align: 4 },
116 t_Int : { size: 4, align: 4 },
117 t_Int8 : { size: 1, align: 1 },
118 t_Int16 : { size: 2, align: 2 },
119 t_Int32 : { size: 4, align: 4 },
120 t_Int64 : { size: 8, align: 8 },
121 t_Long : { size: 4, align: 4 },
122 t_LDouble : { size: 8, align: 8 },
123 t_LLong : { size: 8, align: 8 },
124 t_Ptr : { size: 4, align: 4 },
125 t_Short : { size: 2, align: 2 },
126 t_Size : { size: 4, align: 4 },
127 };
128 }
129 130 131 132
133