diff lwlink/script.c @ 187:857cb407229e

Added LWEX0 (LWOS simple binary) target to lwlink
author lost
date Sun, 22 Mar 2009 04:24:39 +0000
parents 6ebb93b409ba
children bae1e3ecdce1
line wrap: on
line diff
--- a/lwlink/script.c	Sat Mar 21 19:49:01 2009 +0000
+++ b/lwlink/script.c	Sun Mar 22 04:24:39 2009 +0000
@@ -50,6 +50,16 @@
 	"section *,bss\n"
 	;
 
+static char *lwex0_script =
+	"section init load 0100\n"
+	"section .text\n"
+	"section .data\n"
+	"section *,!bss\n"
+	"section *,bss\n"
+	"entry _start\n"
+	"stacksize 0100\n"		// default 256 byte stack
+	;
+
 // the "simple" script
 static char *simple_script = 
 	"section *,!bss\n"
@@ -107,6 +117,10 @@
 			script = decb_script;
 			break;
 		
+		case OUTPUT_LWEX0:
+			script = lwex0_script;
+			break;
+			
 		default:
 			script = simple_script;
 			break;
@@ -132,6 +146,9 @@
 		}
 	}
 
+	if (outformat == OUTPUT_LWEX0)
+		linkscript.stacksize = 0x100;
+
 	oscript = script;
 	// now parse the script file
 	while (*script)
@@ -177,6 +194,14 @@
 			if (linkscript.padsize < 0)
 				linkscript.padsize = 0;
 		}
+		else if (!strcmp(line, "stacksize"))
+		{
+			// stack size for targets that support it
+			// parse the hex number and stow it
+			linkscript.padsize = strtol(ptr, NULL, 16);
+			if (linkscript.stacksize < 0)
+				linkscript.stacksize = 0x100;
+		}
 		else if (!strcmp(line, "entry"))
 		{
 			int eaddr;