Changes to try to get P112 to compile with laster SDCC (it still does not)

This commit is contained in:
Gregory Nutt 2014-08-22 14:48:29 -06:00
parent 1d586e6136
commit 935e76df9f
4 changed files with 95 additions and 9 deletions

View file

@ -1,7 +1,7 @@
############################################################################
# configs/p112/ostest/Make.defs
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@ -81,7 +81,8 @@ AFLAGS = -x -a -l -o -s -g
SDCCLIB = z180.lib
ASMEXT = .asm
OBJEXT = .o
# OBJEXT = .o
OBJEXT = .rel
LIBEXT = .lib
EXEEXT = .hex
@ -122,7 +123,9 @@ endif
# Windows native host tool definitions
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
HOSTCC = mingw32-gcc.exe
# You may need to customize the binary name:
# HOSTCC = mingw32-gcc.exe
HOSTCC = x86_64-w64-mingw32-gcc.exe
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
@ -130,7 +133,7 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
# Windows-native host tools
MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative # --dep-debug
# Use NTFS links or directory copies

View file

@ -2,7 +2,7 @@
rem configs/p112/ostest/setenv.bat
rem
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
rem Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved.
rem Author: Gregory Nutt <gnutt@nuttx.org>
rem
rem Redistribution and use in source and binary forms, with or without
@ -41,7 +41,8 @@ set PATH=C:\MinGW\bin;%PATH%
rem This is the location where I installed the SDCC toolchain for windows.
set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
rem set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
set PATH=C:\Program Files\SDCC/bin;%PATH%
rem This is the location where I installed the GNUWin32 tools. See
rem http://gnuwin32.sourceforge.net/.

View file

@ -115,6 +115,83 @@ typedef struct nx_fontmetric_s
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: MY_strtok_r
*
* Description:
* MinGW does not seem to provide strtok_r
*
****************************************************************************/
#ifndef HAVE_STRTOK_R
static char *MY_strtok_r(char *str, const char *delim, char **saveptr)
{
char *pbegin;
char *pend = NULL;
/* Decide if we are starting a new string or continuing from
* the point we left off.
*/
if (str)
{
pbegin = str;
}
else if (saveptr && *saveptr)
{
pbegin = *saveptr;
}
else
{
return NULL;
}
/* Find the beginning of the next token */
for (;
*pbegin && strchr(delim, *pbegin) != NULL;
pbegin++);
/* If we are at the end of the string with nothing
* but delimiters found, then return NULL.
*/
if (!*pbegin)
{
return NULL;
}
/* Find the end of the token */
for (pend = pbegin + 1;
*pend && strchr(delim, *pend) == NULL;
pend++);
/* pend either points to the end of the string or to
* the first delimiter after the string.
*/
if (*pend)
{
/* Turn the delimiter into a null terminator */
*pend++ = '\0';
}
/* Save the pointer where we left off and return the
* beginning of the token.
*/
if (saveptr)
{
*saveptr = pend;
}
return pbegin;
}
#define strtok_r MY_strtok_r
#endif
/****************************************************************************
* Name: trimLine
*

View file

@ -473,7 +473,7 @@ static void do_dependency(const char *file, char separator)
dotptr = strrchr(objname, '.');
if (dotptr)
{
dotptr = '\0';
*dotptr = '\0';
}
snprintf(tmp, NAME_MAX+6, " -MT %s" DELIM "%s%s ",
@ -515,7 +515,7 @@ static void do_dependency(const char *file, char separator)
g_command[cmdlen] = '\0';
/* Make a copy of g_altpath. We need to do this because at least the version
* of strtok_r above does modifie it.
* of strtok_r above does modify it.
*/
alloc = strdup(g_altpath);
@ -598,6 +598,11 @@ static void do_dependency(const char *file, char separator)
* from the compiler is in WEXITSTATUS(ret).
*/
if (g_debug)
{
fprintf(stderr, "Executing: %s\n", g_command);
}
ret = system(g_command);
#ifdef WEXITSTATUS
if (ret < 0 || WEXITSTATUS(ret) != 0)
@ -687,7 +692,7 @@ static char *cywin2windows(const char *str, const char *append, enum slashmode_e
drive = toupper(*str);
if (drive < 'A' || drive > 'Z')
{
fprintf(stderr, "ERROR: Drive charager: \"%s\"\n", str);
fprintf(stderr, "ERROR: Drive character: \"%s\"\n", str);
exit(EXIT_FAILURE);
}