Working on EMBED and overlay tool. NOT TESTED AT ALL!
This commit is contained in:
parent
a717e5d66a
commit
8fbd2f1b72
7 changed files with 322 additions and 87 deletions
|
@ -97,8 +97,12 @@ pushd distro
|
|||
if [[ -f ../f256dev.7z ]]; then
|
||||
rm ../f256dev.7z
|
||||
fi
|
||||
|
||||
7z a ../f256dev.7z .
|
||||
|
||||
if [[ -f ../f256dev.tar.xz ]]; then
|
||||
rm ../f256dev.tar.xz
|
||||
fi
|
||||
tar cjf ../f256dev.tar.xz .
|
||||
|
||||
popd
|
||||
popd
|
||||
|
|
|
@ -41,8 +41,6 @@ set REMOTE4=https://github.com/pweingar/FoenixMgr/archive/refs/heads/master.zip
|
|||
set LOCAL4=master.zip
|
||||
|
||||
|
||||
if exist f256dev\ rd /s /q f256dev
|
||||
|
||||
if exist "%ProgramFiles%\7-Zip\7z.exe" (
|
||||
set UNPACK="%ProgramFiles%\7-Zip\7z.exe"
|
||||
) else (
|
||||
|
@ -86,6 +84,7 @@ if errorlevel 1 (
|
|||
|
||||
%LOCAL3% /install /passive
|
||||
|
||||
if exist f256dev\ rd /s /q f256dev
|
||||
md f256dev
|
||||
pushd f256dev
|
||||
%UNPACK% x -y ..\%LOCAL1%
|
||||
|
@ -116,8 +115,8 @@ pushd f256dev
|
|||
echo @"%%~dp0mos-clang.exe" --config mos-f256.cfg %%* > llvm-mos\bin\mos-f256-clang.bat
|
||||
popd
|
||||
|
||||
echo @"%~dp0f256dev\f256build.bat" "%%~dp0" %%* > f256build.bat
|
||||
echo @"%~dp0f256dev\f256run.bat" "%%~dp0" %%* > f256run.bat
|
||||
if not exist f256build.bat echo @"%~dp0f256dev\f256build.bat" "%%~dp0" %%* > f256build.bat
|
||||
if not exist f256run.bat echo @"%~dp0f256dev\f256run.bat" "%%~dp0" %%* > f256run.bat
|
||||
|
||||
if not exist foenixmgr.ini (
|
||||
echo [DEFAULT] > foenixmgr.ini
|
||||
|
|
|
@ -43,18 +43,13 @@ else
|
|||
LOCAL1=llvm-mos-macos.tar.xz
|
||||
fi
|
||||
|
||||
REMOTE2=https://kangaroopunch.com/files/serve/shared/llvm-mos-f256.tar.xz
|
||||
REMOTE2=https://kangaroopunch.com/files/serve/shared/f256dev.tar.xz
|
||||
LOCAL2=llvm-mos-f256.tar.xz
|
||||
|
||||
REMOTE3=https://github.com/pweingar/FoenixMgr/archive/refs/heads/master.zip
|
||||
LOCAL3=master.zip
|
||||
|
||||
|
||||
if [[ -d $(basename -s .tar.xz ${LOCAL1}) ]]; then
|
||||
echo "You already have an llvm-mos directory. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PYTHON=$(which python)
|
||||
if [[ $? == 1 ]]; then
|
||||
PYTHON=$(which python3)
|
||||
|
@ -96,42 +91,66 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
tar xf ${LOCAL1}
|
||||
if [[ -z ${MAC} ]]; then
|
||||
xattr -d com.apple.quarantine ${LOCAL1}
|
||||
xattr -d com.apple.quarantine ${LOCAL2}
|
||||
xattr -d com.apple.quarantine ${LOCAL3}
|
||||
fi
|
||||
|
||||
if [[ -d f256dev ]]; then
|
||||
rm -rf f256dev
|
||||
fi
|
||||
mkdir -p f256dev
|
||||
pushd f256dev
|
||||
tar xf ${LOCAL1}
|
||||
unzip -o ${LOCAL3}
|
||||
popd
|
||||
|
||||
tar xf ${LOCAL2}
|
||||
unzip -o ${LOCAL3}
|
||||
|
||||
rm ${LOCAL1}
|
||||
rm ${LOCAL2}
|
||||
rm ${LOCAL3}
|
||||
|
||||
rm -f overlay.windows
|
||||
if [[ -z ${MAC} ]]; then
|
||||
rm -f overlay.macos
|
||||
mv overlay.linux overlay
|
||||
else
|
||||
rm -f overlay.linux
|
||||
mv overlay.macos overlay
|
||||
pushd f256dev
|
||||
rm -f overlay.windows
|
||||
if [[ -z ${MAC} ]]; then
|
||||
rm -f overlay.macos
|
||||
mv overlay.linux overlay
|
||||
else
|
||||
rm -f overlay.linux
|
||||
mv overlay.macos overlay
|
||||
fi
|
||||
|
||||
rm -f *.bat
|
||||
|
||||
pushd llvm-mos/bin
|
||||
ln -s mos-clang++ mos-f256-clang++
|
||||
ln -s mos-clang-cpp mos-f256-clang-cpp
|
||||
ln -s mos-clang mos-f256-clang
|
||||
popd
|
||||
|
||||
mv FoenixMgr-master FoenixMgr
|
||||
pushd FoenixMgr
|
||||
${PIP} install -r requirements.txt
|
||||
popd
|
||||
popd
|
||||
|
||||
if [[ ! -e f256build.sh ]]; then
|
||||
ln -s f256dev/f256build.sh .
|
||||
fi
|
||||
if [[ ! -e f256run.sh ]]; then
|
||||
ln -s f256dev/f256run.sh .
|
||||
fi
|
||||
|
||||
rm -f *.bat
|
||||
|
||||
mv FoenixMgr-master FoenixMgr
|
||||
pushd FoenixMgr
|
||||
${PIP} install -r requirements.txt
|
||||
popd
|
||||
|
||||
echo "[DEFAULT]" > foenixmgr.ini
|
||||
echo "port=/dev/ttyUSB0" >> foenixmgr.ini
|
||||
echo "labels=sample.lbl" >> foenixmgr.ini
|
||||
echo "flash_address=380000" >> foenixmgr.ini
|
||||
echo "chunk_size=1024" >> foenixmgr.ini
|
||||
echo "cpu=65c02" >> foenixmgr.ini
|
||||
|
||||
pushd llvm-mos/bin
|
||||
ln -s mos-clang++ mos-f256-clang++
|
||||
ln -s mos-clang-cpp mos-f256-clang-cpp
|
||||
ln -s mos-clang mos-f256-clang
|
||||
popd
|
||||
if [[ ! -f foenixmgr.ini ]]; then
|
||||
echo "[DEFAULT]" > foenixmgr.ini
|
||||
echo "port=/dev/ttyUSB0" >> foenixmgr.ini
|
||||
echo "labels=sample.lbl" >> foenixmgr.ini
|
||||
echo "flash_address=380000" >> foenixmgr.ini
|
||||
echo "chunk_size=1024" >> foenixmgr.ini
|
||||
echo "cpu=65c02" >> foenixmgr.ini
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -----------------------------------------------------------------------------
|
||||
|
|
|
@ -27,7 +27,16 @@
|
|||
#
|
||||
|
||||
|
||||
ROOT=$(pwd)
|
||||
SCRIPT_PATH="${BASH_SOURCE}"
|
||||
while [ -L "${SCRIPT_PATH}" ]; do
|
||||
SCRIPT_DIR="$(cd -P "$(dirname "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
||||
SCRIPT_PATH="$(readlink "${SCRIPT_PATH}")"
|
||||
[[ ${SCRIPT_PATH} != /* ]] && SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_PATH}"
|
||||
done
|
||||
SCRIPT_PATH="$(readlink -f "${SCRIPT_PATH}")"
|
||||
SCRIPT_DIR="$(cd -P "$(dirname -- "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
ROOT=${SCRIPT_DIR}
|
||||
|
||||
if [[ -z ${1} ]]; then
|
||||
echo No project folder provided.
|
||||
|
@ -48,7 +57,7 @@ if [[ $? == 1 ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
PROJECT=${ROOT}/${1}
|
||||
PROJECT="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
||||
SOURCE=${PROJECT}/src
|
||||
BUILD=${PROJECT}/.builddir
|
||||
NAME=$(basename ${PROJECT})
|
||||
|
@ -59,11 +68,14 @@ pushd "${PROJECT}" > /dev/null
|
|||
mkdir -p .builddir
|
||||
cd .builddir
|
||||
"${ROOT}/overlay" 5 "${BUILD}" "${SOURCE}"
|
||||
if [[ ! -f "${PROJECT}/f256.ld" ]]; then
|
||||
cp -f "${ROOT}/llvm-mos/mos-platform/f256/lib/link.ld" "${PROJECT}/f256.ld"
|
||||
if [[ -f "${PROJECT}/f256.ld" ]]; then
|
||||
cp -f "${PROJECT}/f256.ld" f256.ld
|
||||
fi
|
||||
if [[ ! -f f256.ld ]]; then
|
||||
cp -f "${ROOT}/llvm-mos/mos-platform/f256/lib/link.ld" f256.ld
|
||||
fi
|
||||
export PATH=${ROOT}/llvm-mos/bin:${PATH}
|
||||
mos-f256-clang -T ../f256.ld -Wl,-Map=${NAME}.map -o ${NAME} -I"${ROOT}" -Os -Wall -lm *.c
|
||||
mos-f256-clang -T f256.ld -Wl,-Map=${NAME}.map -o ${NAME} -I"${ROOT}" -Os -Wall -lm *.c
|
||||
if [[ $? == 0 ]]; then
|
||||
mv ${NAME} ${NAME}.pgz
|
||||
llvm-nm ${NAME}.elf > ${NAME}.sym
|
||||
|
|
|
@ -27,7 +27,16 @@
|
|||
#
|
||||
|
||||
|
||||
ROOT=$(pwd)
|
||||
SCRIPT_PATH="${BASH_SOURCE}"
|
||||
while [ -L "${SCRIPT_PATH}" ]; do
|
||||
SCRIPT_DIR="$(cd -P "$(dirname "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
||||
SCRIPT_PATH="$(readlink "${SCRIPT_PATH}")"
|
||||
[[ ${SCRIPT_PATH} != /* ]] && SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_PATH}"
|
||||
done
|
||||
SCRIPT_PATH="$(readlink -f "${SCRIPT_PATH}")"
|
||||
SCRIPT_DIR="$(cd -P "$(dirname -- "${SCRIPT_PATH}")" >/dev/null 2>&1 && pwd)"
|
||||
|
||||
ROOT=${SCRIPT_DIR}
|
||||
|
||||
if [[ -z ${1} ]]; then
|
||||
echo "No project folder provided."
|
||||
|
@ -43,7 +52,7 @@ if [[ $? == 1 ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
PROJECT=${ROOT}/${1}
|
||||
PROJECT="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
|
||||
NAME=$(basename ${PROJECT})
|
||||
if [[ ! -f "${PROJECT}/${NAME}.pgz" ]]; then
|
||||
echo "No PGZ found."
|
||||
|
|
|
@ -129,8 +129,8 @@ typedef struct colorS {
|
|||
// Allow embedding binary data into program
|
||||
#define IBSTR2(x) #x
|
||||
#define IBSTR(x) IBSTR2(x)
|
||||
#define EMBED(INCBIN_SECTION, name, file) \
|
||||
__asm__(".section " INCBIN_SECTION ",\"aR\" \n" \
|
||||
#define EMBED(name, file, address) \
|
||||
__asm__(".section binary." IBSTR(name) ",\"aR\" \n" \
|
||||
".global incbin_" IBSTR(name) "_start\n" \
|
||||
".balign 16\n" \
|
||||
"incbin_" IBSTR(name) "_start:\n" \
|
||||
|
@ -141,8 +141,8 @@ typedef struct colorS {
|
|||
"incbin_" IBSTR(name) "_end:\n" \
|
||||
".byte 0\n" \
|
||||
); \
|
||||
extern __attribute__((aligned(16))) const char incbin_ ## name ## _start[]; \
|
||||
extern const char incbin_ ## name ## _end[]
|
||||
extern __attribute__((aligned(16))) const char ## name ## _start[]; \
|
||||
extern const char ## name ## _end[]
|
||||
|
||||
|
||||
// Single-byte
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -37,10 +38,21 @@
|
|||
#define BLOCK_COUNT 15 // Could be up to 56 blocks, 8-64. f256.ld needs updated for more.
|
||||
|
||||
|
||||
typedef struct EmbedS {
|
||||
char *name;
|
||||
char *filename;
|
||||
uint64_t address;
|
||||
struct EmbedS *next;
|
||||
} EmbedT;
|
||||
|
||||
|
||||
unsigned char _currentBank = 0; // 0 == lower 64k
|
||||
unsigned char _totalBanks = 0; // Not including lower 64k
|
||||
char *_bankName[BLOCK_COUNT]; // Far blocks (8+), shifted down 8.
|
||||
|
||||
EmbedT *_embeds = NULL;
|
||||
EmbedT *_embedsHead = NULL;
|
||||
|
||||
|
||||
void findBank(char *name);
|
||||
void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampolineFile, int swapSlot);
|
||||
|
@ -79,25 +91,29 @@ void findBank(char *name) {
|
|||
|
||||
|
||||
void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampolineFile, int swapSlot) {
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
int c;
|
||||
char arguments[BUFFER_SIZE];
|
||||
char buffer[BUFFER_SIZE];
|
||||
char *functionName;
|
||||
char *start;
|
||||
char *a;
|
||||
char *b;
|
||||
bool isPointer;
|
||||
bool found;
|
||||
int x;
|
||||
int line = 1;
|
||||
int comments = 0;
|
||||
bool inComment = false;
|
||||
int brackets = 0;
|
||||
int crSinceStart = 0;
|
||||
int pos = 0;
|
||||
char *segDef = "#define SEGMENT_";
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
int c;
|
||||
char arguments[BUFFER_SIZE];
|
||||
char buffer[BUFFER_SIZE];
|
||||
char *functionName;
|
||||
char *start;
|
||||
char *a;
|
||||
char *b;
|
||||
char *d;
|
||||
char *e;
|
||||
char *f;
|
||||
bool isPointer;
|
||||
bool found;
|
||||
int x;
|
||||
int line = 1;
|
||||
int comments = 0;
|
||||
bool inComment = false;
|
||||
int brackets = 0;
|
||||
int crSinceStart = 0;
|
||||
int pos = 0;
|
||||
char *segDef = "#define SEGMENT_";
|
||||
EmbedT *newEmbed;
|
||||
|
||||
/*
|
||||
* This parser sucks.
|
||||
|
@ -268,6 +284,7 @@ void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampo
|
|||
} else { // Brackets
|
||||
|
||||
// Is this a segment definition? "#define SEGMENT_<something>"
|
||||
// ***TODO*** This doesn't allow the definition to be indented.
|
||||
found = false;
|
||||
if (pos > strlen(segDef)) {
|
||||
found = true;
|
||||
|
@ -283,7 +300,88 @@ void parseCFile(char *filename, char *targetFile, FILE *trampoline, char *trampo
|
|||
findBank(&buffer[strlen(segDef)]);
|
||||
}
|
||||
|
||||
// Write to output in case they depend on the define for some odd reason.
|
||||
// Is this an EMBED? "EMBED(name, file, address);"
|
||||
found = false; // This is tracking if we're quoted or not.
|
||||
start = strstr(buffer, "EMBED");
|
||||
if (start != NULL) {
|
||||
// Scan for opening paren, three arguments.
|
||||
// We use 'c' to track what we're currently looking for.
|
||||
c = 0;
|
||||
a = NULL; // Start of first argument.
|
||||
b = NULL; // End of first argument.
|
||||
d = NULL; // Start of second argument.
|
||||
e = NULL; // End of second argument.
|
||||
f = NULL; // Start of third argument.
|
||||
for (x=0; x<strlen(buffer); x++) {
|
||||
switch (c) {
|
||||
case 0: // Opening parenthesis.
|
||||
if (buffer[x] == '(') c++;
|
||||
break;
|
||||
case 1: // Start of first argument.
|
||||
if (buffer[x] != ' ') {
|
||||
a = &buffer[x];
|
||||
c++;
|
||||
}
|
||||
break;
|
||||
case 2: // End of first argument.
|
||||
if ((buffer[x] == ' ') || (buffer[x] == ',')) {
|
||||
b = &buffer[x];
|
||||
c++;
|
||||
if (buffer[x] == ',') c++;
|
||||
}
|
||||
break;
|
||||
case 3: // Comma at end of first argument.
|
||||
if (buffer[x] == ',') c++;
|
||||
break;
|
||||
case 4: // Filename to embed.
|
||||
if (buffer[x] == '"') {
|
||||
// ***TODO*** This will barf if the filename has a " in it.
|
||||
if (!found) {
|
||||
d = &buffer[x];
|
||||
} else {
|
||||
found = !found;
|
||||
e = &buffer[x];
|
||||
}
|
||||
} else {
|
||||
if ((!found) && (buffer[x] == ',')) c++;
|
||||
}
|
||||
break;
|
||||
case 5: // Address to load.
|
||||
if (buffer[x] != ' ') {
|
||||
f = &buffer[x];
|
||||
c++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c == 6) break; // Exit FOR loop.
|
||||
}
|
||||
// Did we find what we needed?
|
||||
if (c == 6) {
|
||||
newEmbed = (EmbedT *)calloc(1, sizeof(EmbedT));
|
||||
// Name.
|
||||
x = *b;
|
||||
*b = 0;
|
||||
newEmbed->name = strdup(a);
|
||||
*b = x;
|
||||
// Filename.
|
||||
x = *e;
|
||||
*e = 0;
|
||||
newEmbed->name = strdup(d);
|
||||
*e = x;
|
||||
// Address.
|
||||
newEmbed->address = atol(f);
|
||||
// Add to list.
|
||||
if (_embeds == NULL) {
|
||||
_embeds = newEmbed;
|
||||
_embedsHead = _embeds;
|
||||
} else {
|
||||
_embedsHead->next = newEmbed;
|
||||
_embedsHead = newEmbed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write to output.
|
||||
fprintf(out, "%s\n", buffer);
|
||||
|
||||
} // Brackets.
|
||||
|
@ -322,22 +420,28 @@ void trimEnd(char *string) {
|
|||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE *out;
|
||||
int x;
|
||||
int r;
|
||||
int nearSlot;
|
||||
char *targetDir;
|
||||
char *sourceDir;
|
||||
char *trampolineFile;
|
||||
char *linkerFile;
|
||||
char *cFile;
|
||||
char *targetFile;
|
||||
char *thisDir;
|
||||
int sourceDirOffset;
|
||||
int thisOffset;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
struct stat fileStat;
|
||||
FILE *out;
|
||||
FILE *out2;
|
||||
FILE *out3;
|
||||
FILE *in;
|
||||
int x;
|
||||
int r;
|
||||
int nearSlot;
|
||||
char *targetDir;
|
||||
char *sourceDir;
|
||||
char *trampolineFile;
|
||||
char *linkerFile;
|
||||
char *linkerFile2;
|
||||
char *linkerFile3;
|
||||
char *cFile;
|
||||
char *targetFile;
|
||||
char *thisDir;
|
||||
int sourceDirOffset;
|
||||
int thisOffset;
|
||||
uint64_t length;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
struct stat fileStat;
|
||||
|
||||
/*
|
||||
* Command line:
|
||||
|
@ -456,7 +560,78 @@ int main(int argc, char *argv[]) {
|
|||
fclose(out);
|
||||
free(trampolineFile);
|
||||
|
||||
// Generate linker script data.
|
||||
// Generate linker script declaration data.
|
||||
linkerFile = utilCreateString("%s%cdeclare.ld", targetDir, utilGetPathSeparator());
|
||||
out = fopen(linkerFile, "wt");
|
||||
if (out == NULL) {
|
||||
fprintf(stderr, "ERROR! Cannot create %s!\n", linkerFile);
|
||||
free(targetDir);
|
||||
free(linkerFile);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Generate linker script MEMORY data.
|
||||
linkerFile2 = utilCreateString("%s%cmemory.ld", targetDir, utilGetPathSeparator());
|
||||
out2 = fopen(linkerFile2, "wt");
|
||||
if (out2 == NULL) {
|
||||
fprintf(stderr, "ERROR! Cannot create %s!\n", linkerFile2);
|
||||
free(targetDir);
|
||||
free(linkerFile);
|
||||
free(linkerFile2);
|
||||
fclose(out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Generate linker script SECTIONS data.
|
||||
linkerFile3 = utilCreateString("%s%csections.ld", targetDir, utilGetPathSeparator());
|
||||
out3 = fopen(linkerFile3, "wt");
|
||||
if (out3 == NULL) {
|
||||
fprintf(stderr, "ERROR! Cannot create %s!\n", linkerFile3);
|
||||
free(targetDir);
|
||||
free(linkerFile);
|
||||
free(linkerFile2);
|
||||
free(linkerFile3);
|
||||
fclose(out);
|
||||
fclose(out2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Populate three linker sections.
|
||||
_embedsHead = _embeds;
|
||||
while (_embedsHead != NULL) {
|
||||
// Declaration.
|
||||
in = fopen(_embedsHead->filename, "rb"); // ***TODO*** This path will be wrong.
|
||||
if (in == NULL) {
|
||||
free(targetDir);
|
||||
free(linkerFile);
|
||||
free(linkerFile2);
|
||||
free(linkerFile3);
|
||||
fclose(out);
|
||||
fclose(out2);
|
||||
fclose(out3);
|
||||
return 1;
|
||||
}
|
||||
fseek(in, 0, SEEK_END);
|
||||
length = ftell(in);
|
||||
fclose(in);
|
||||
fprintf(out, " __%s_lma = %lx;\n", _embedsHead->name, _embedsHead->address);
|
||||
fprintf(out, " __%s_size = %lx;\n\n", _embedsHead->name, length);
|
||||
// MEMORY.
|
||||
fprintf(out2, " %s : ORIGIN = __%s_lma, LENGTH = __%s_size\n", _embedsHead->name, _embedsHead->name, _embedsHead->name);
|
||||
// SECTIONS.
|
||||
fprintf(out3, " .%s : { *(.%s .%s*) } >%s end_%s = .;\n", _embedsHead->name, _embedsHead->name, _embedsHead->name, _embedsHead->name, _embedsHead->name);
|
||||
|
||||
_embedsHead = _embedsHead->next;
|
||||
}
|
||||
|
||||
free(linkerFile);
|
||||
free(linkerFile2);
|
||||
free(linkerFile3);
|
||||
fclose(out);
|
||||
fclose(out2);
|
||||
fclose(out3);
|
||||
|
||||
// Generate linker script OUTPUT_FORMAT data.
|
||||
linkerFile = utilCreateString("%s%coutput.ld", targetDir, utilGetPathSeparator());
|
||||
out = fopen(linkerFile, "wt");
|
||||
if (out == NULL) {
|
||||
|
@ -472,6 +647,15 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(out, " BYTE(0x00)\n");
|
||||
fprintf(out, " TRIM(block%d)\n\n", x+8);
|
||||
}
|
||||
_embedsHead = _embeds;
|
||||
while (_embedsHead != NULL) {
|
||||
fprintf(out, " SHORT(ORIGIN(%s))\n", _embedsHead->name);
|
||||
fprintf(out, " BYTE(ORIGIN(%s)>>16)\n", _embedsHead->name);
|
||||
fprintf(out, " SHORT(end_%s - __%s_lma)\n", _embedsHead->name, _embedsHead->name);
|
||||
fprintf(out, " BYTE((end_%s - __%s_lma)>>16)\n", _embedsHead->name, _embedsHead->name);
|
||||
fprintf(out, " TRIM(%s)\n\n", _embedsHead->name);
|
||||
_embedsHead = _embedsHead->next;
|
||||
}
|
||||
fclose(out);
|
||||
free(linkerFile);
|
||||
|
||||
|
@ -480,6 +664,14 @@ int main(int argc, char *argv[]) {
|
|||
free(_bankName[x]);
|
||||
}
|
||||
free(targetDir);
|
||||
_embedsHead = _embeds;
|
||||
while (_embedsHead != NULL) {
|
||||
free(_embedsHead->name);
|
||||
free(_embedsHead->filename);
|
||||
_embeds = _embedsHead;
|
||||
_embedsHead = _embedsHead->next;
|
||||
free(_embeds);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue