summaryrefslogtreecommitdiff
path: root/src/stm8
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-22 02:10:51 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-22 02:10:51 +0200
commit5a0c2910df62b99fee8baec1f4d846217cd9a054 (patch)
tree583963809fe49cbb8b498f6621862589601ba53d /src/stm8
parent958912f9285175ff95bb0070bea603dd8aef8222 (diff)
downloadsdcc-gas-5a0c2910df62b99fee8baec1f4d846217cd9a054.tar.gz
First working example!
stm8/main.c: 0x8000 must contain the entry point aka "_start" for GNU as. Some work on supporting debugging symbols with --gas. Not finished yet.
Diffstat (limited to 'src/stm8')
-rw-r--r--src/stm8/gen.c9
-rw-r--r--src/stm8/main.c7
2 files changed, 11 insertions, 5 deletions
diff --git a/src/stm8/gen.c b/src/stm8/gen.c
index ff195d9..80fd74e 100644
--- a/src/stm8/gen.c
+++ b/src/stm8/gen.c
@@ -2339,7 +2339,12 @@ void
stm8_emitDebuggerSymbol (const char *debugSym)
{
G.debugLine = 1;
- emit2 ("", "%s ==.", debugSym);
+
+ if (options.gasOutput)
+ emit2 ("", "%s:", debugSym);
+ else
+ emit2 ("", "%s ==.", debugSym);
+
G.debugLine = 0;
}
@@ -3358,6 +3363,8 @@ genFunction (iCode *ic)
emit2 (";", " function %s", sym->name);
emit2 (";", "-----------------------------------------");
+ /* Place each new function into its own section so GNU ld
+ * can perform dead code elimination via --gc-sections. */
if (options.function_sections && options.gasOutput)
{
char name[256];
diff --git a/src/stm8/main.c b/src/stm8/main.c
index dbef2a8..b935f96 100644
--- a/src/stm8/main.c
+++ b/src/stm8/main.c
@@ -29,7 +29,6 @@
#include "gen.h"
#include "dbuf_string.h"
#include "peep.h"
-#include "SDCCgas.h"
#include "SDCCglobl.h"
#define OPTION_MEDIUM_MODEL "--model-medium"
@@ -277,7 +276,7 @@ stm8_genInitStartup (FILE *of)
else
{
fprintf(of,
- ".global _start\n"
+ "\t.global _start\n"
"_start:\n"
"\t; Zeroing .bss\n"
"\tldw x, __bss_start\n"
@@ -308,7 +307,8 @@ stm8_genIVT(struct dbuf_s * oBuf, symbol ** intTable, int intCount)
int i;
if (options.gasOutput)
- dbuf_tprintf(oBuf, "\tint __interrupt_vect ; reset\n");
+ /* Set entry point address. */
+ dbuf_tprintf(oBuf, "\tint _start ; reset\n");
else
dbuf_tprintf(oBuf, "\tint s_GSINIT ; reset\n");
@@ -441,7 +441,6 @@ PORT stm8_port =
MODEL_MEDIUM | MODEL_LARGE,
MODEL_MEDIUM,
&get_model, /* model string used as library destination */
- gas_glue
},
{ /* Assembler */
stm8AsmCmd,