tools/: Update and verify all configuration related tools with new, boards directory layout.
This commit is contained in:
parent
c840ac2496
commit
4b6f634a90
@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
static void show_usage(const char *progname, int exitcode);
|
static void show_usage(const char *progname, int exitcode);
|
||||||
static void debug(const char *fmt, ...);
|
static void debug(const char *fmt, ...);
|
||||||
static const char *find_archname(const char *boardname);
|
static int find_archname(const char *boardname, const char *configname);
|
||||||
static void parse_args(int argc, char **argv);
|
static void parse_args(int argc, char **argv);
|
||||||
static bool check_directory(const char *directory);
|
static bool check_directory(const char *directory);
|
||||||
static void verify_directory(const char *directory);
|
static void verify_directory(const char *directory);
|
||||||
@ -121,6 +121,7 @@ static bool g_debug = false; /* Enable debug output */
|
|||||||
|
|
||||||
static const char *g_appdir = NULL; /* Relative path to the application directory */
|
static const char *g_appdir = NULL; /* Relative path to the application directory */
|
||||||
static const char *g_archdir = NULL; /* Name of architecture subdirectory */
|
static const char *g_archdir = NULL; /* Name of architecture subdirectory */
|
||||||
|
static const char *g_chipdir = NULL; /* Name of chip subdirectory */
|
||||||
static const char *g_boarddir = NULL; /* Name of board subdirectory */
|
static const char *g_boarddir = NULL; /* Name of board subdirectory */
|
||||||
static char *g_configdir = NULL; /* Name of configuration subdirectory */
|
static char *g_configdir = NULL; /* Name of configuration subdirectory */
|
||||||
|
|
||||||
@ -166,6 +167,68 @@ static const char *g_archnames[] =
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Recognized chip names */
|
||||||
|
|
||||||
|
static const char *g_chipnames[] =
|
||||||
|
{
|
||||||
|
"a1x",
|
||||||
|
"am335x",
|
||||||
|
"c5471",
|
||||||
|
"cxd56xx",
|
||||||
|
"dm320",
|
||||||
|
"efm32",
|
||||||
|
"imx6",
|
||||||
|
"imxrt",
|
||||||
|
"kinetis",
|
||||||
|
"kl",
|
||||||
|
"lc823450",
|
||||||
|
"lpc17xx_40xx",
|
||||||
|
"lpc214x",
|
||||||
|
"lpc2378",
|
||||||
|
"lpc31xx",
|
||||||
|
"lpc43xx",
|
||||||
|
"lpc54xx",
|
||||||
|
"max326xx",
|
||||||
|
"moxart",
|
||||||
|
"nrf52",
|
||||||
|
"nuc1xx",
|
||||||
|
"sam34",
|
||||||
|
"sama5",
|
||||||
|
"samd2l2",
|
||||||
|
"samd5e5",
|
||||||
|
"samv7",
|
||||||
|
"stm32",
|
||||||
|
"stm32f0l0g0",
|
||||||
|
"stm32f7",
|
||||||
|
"stm32h7",
|
||||||
|
"stm32l4",
|
||||||
|
"str71x",
|
||||||
|
"tiva",
|
||||||
|
"tms570",
|
||||||
|
"xmc4",
|
||||||
|
"at32uc3",
|
||||||
|
"at90usb",
|
||||||
|
"atmega",
|
||||||
|
"mcs92s12ne64",
|
||||||
|
"pic32mx",
|
||||||
|
"pic32mz",
|
||||||
|
"lm32",
|
||||||
|
"mor1kx",
|
||||||
|
"m32262f8",
|
||||||
|
"sh7032",
|
||||||
|
"gap8",
|
||||||
|
"nr5m100",
|
||||||
|
"sim",
|
||||||
|
"qemu",
|
||||||
|
"esp32",
|
||||||
|
"z16f2811",
|
||||||
|
"ez80",
|
||||||
|
"z180",
|
||||||
|
"z8",
|
||||||
|
"z80",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/* Optional configuration files */
|
/* Optional configuration files */
|
||||||
|
|
||||||
static const char *g_optfiles[] =
|
static const char *g_optfiles[] =
|
||||||
@ -248,52 +311,49 @@ static void debug(const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *find_archname(const char *boardname)
|
static int find_archname(const char *boardname, const char *configname)
|
||||||
{
|
{
|
||||||
const char **archname;
|
const char **archname;
|
||||||
DIR *dirp;
|
const char **chipname;
|
||||||
struct dirent *dentry;
|
struct stat statbuf;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* Try each combination of board and chip names */
|
||||||
|
|
||||||
for (archname = g_archnames; *archname != NULL; archname++)
|
for (archname = g_archnames; *archname != NULL; archname++)
|
||||||
{
|
{
|
||||||
/* Get the architecture directory under boards */
|
for (chipname = g_chipnames; *chipname != NULL; chipname++)
|
||||||
|
|
||||||
snprintf(g_buffer, BUFFER_SIZE, "boards/%s", *archname);
|
|
||||||
|
|
||||||
/* Open the architecture directory */
|
|
||||||
|
|
||||||
dirp = opendir(g_buffer);
|
|
||||||
if (dirp == NULL)
|
|
||||||
{
|
{
|
||||||
debug("ERROR: Failed to open: %s\n", g_buffer);
|
/* Get the architecture directory under boards. Path format:
|
||||||
continue;
|
* board/<arch-name>/<chip-name>/<board-name>/configs/<config-name>
|
||||||
}
|
|
||||||
|
|
||||||
/* Now search for a sub-directory that has the board name */
|
|
||||||
|
|
||||||
while ((dentry = readdir(dirp)) != NULL)
|
|
||||||
{
|
|
||||||
/* Check if the directory entry matches the boardname.
|
|
||||||
* We really should also verify that it is a directory.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strcmp(boardname, dentry->d_name) == 0)
|
snprintf(g_buffer, BUFFER_SIZE, "boards%c%s%c%s%c%s%cconfigs%c%s",
|
||||||
|
g_delim, *archname, g_delim, *chipname, g_delim, boardname,
|
||||||
|
g_delim, g_delim, configname);
|
||||||
|
|
||||||
|
/* Check if there is a directory at this path */
|
||||||
|
|
||||||
|
ret = stat(g_buffer, &statbuf);
|
||||||
|
if (ret == 0 && S_ISDIR(statbuf.st_mode))
|
||||||
{
|
{
|
||||||
closedir(dirp);
|
g_archdir = *archname;
|
||||||
return *archname;
|
g_chipdir = *chipname;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dirp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
g_archdir = "unknown";
|
||||||
|
g_chipdir = "unknown";
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_args(int argc, char **argv)
|
static void parse_args(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int ch;
|
int ch;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Parse command line options */
|
/* Parse command line options */
|
||||||
|
|
||||||
@ -407,12 +467,11 @@ static void parse_args(int argc, char **argv)
|
|||||||
show_usage(argv[0], EXIT_FAILURE);
|
show_usage(argv[0], EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_archdir = find_archname(g_boarddir);
|
ret = find_archname(g_boarddir, g_configdir);
|
||||||
if (g_archdir == NULL)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Architecture for board %s not found\n",
|
fprintf(stderr, "ERROR: Architecture for board %s not found\n",
|
||||||
g_boarddir);
|
g_boarddir);
|
||||||
g_archdir = "unknown";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,12 +704,18 @@ static void config_search(const char *boarddir)
|
|||||||
char *boardname;
|
char *boardname;
|
||||||
char *configname;
|
char *configname;
|
||||||
char *delim;
|
char *delim;
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
/* Get the board directory near the beginning of the 'boarddir' path:
|
/* Get the board directory near the beginning of the 'boarddir' path:
|
||||||
* <archdir>/<boarddir>/configs/<configdir>
|
* <archdir>/<chipdir>/<boarddir>/configs/<configdir>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Make a modifiable copy */
|
||||||
|
|
||||||
strncpy(g_buffer, boarddir, BUFFER_SIZE);
|
strncpy(g_buffer, boarddir, BUFFER_SIZE);
|
||||||
|
|
||||||
|
/* Skip over <archdir> */
|
||||||
|
|
||||||
delim = strchr(g_buffer, g_delim);
|
delim = strchr(g_buffer, g_delim);
|
||||||
if (delim == NULL)
|
if (delim == NULL)
|
||||||
{
|
{
|
||||||
@ -658,27 +723,42 @@ static void config_search(const char *boarddir)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*delim = '\0';
|
/* Skip over <chipdir> */
|
||||||
boardname = delim + 1;
|
|
||||||
|
|
||||||
delim = strchr(boardname, g_delim);
|
tmp = delim + 1;
|
||||||
|
delim = strchr(tmp, g_delim);
|
||||||
if (delim == NULL)
|
if (delim == NULL)
|
||||||
{
|
{
|
||||||
debug("ERROR: delimiter not found in path: %s\n", boardname);
|
debug("ERROR: delimiter not found in path: %s\n", tmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*delim = '\0';
|
/* Save the <boardir> */
|
||||||
delim = strrchr(delim + 1, g_delim);
|
|
||||||
|
*delim = '\0';
|
||||||
|
boardname = delim + 1;
|
||||||
|
|
||||||
|
delim = strchr(boardname, g_delim);
|
||||||
if (delim == NULL)
|
if (delim == NULL)
|
||||||
{
|
{
|
||||||
debug("ERROR: Configuration directory not found in path: %s\n",
|
debug("ERROR: delimiter not found in path: %s\n", boardname);
|
||||||
boardname);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
configname = delim + 1;
|
/* Save the <configdir> */
|
||||||
fprintf(stderr, " %s:%s\n", boardname, configname);
|
|
||||||
|
*delim = '\0';
|
||||||
|
delim = strrchr(delim + 1, g_delim);
|
||||||
|
if (delim == NULL)
|
||||||
|
{
|
||||||
|
debug("ERROR: Configuration directory not found in path: %s\n",
|
||||||
|
boardname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configname = delim + 1;
|
||||||
|
fprintf(stderr, " %s:%s\n", boardname, configname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -708,12 +788,12 @@ static void check_configdir(void)
|
|||||||
g_configtop = strdup(g_buffer);
|
g_configtop = strdup(g_buffer);
|
||||||
|
|
||||||
/* Get and verify the path to the selected configuration:
|
/* Get and verify the path to the selected configuration:
|
||||||
* boards/<archdir>/<boarddir>/configs/<configdir>
|
* boards/<archdir>/<chipdir>/<boarddir>/configs/<configdir>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%c%s%cconfigs%c%s",
|
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%c%s%c%s%cconfigs%c%s",
|
||||||
g_topdir, g_delim, g_delim, g_archdir, g_delim, g_boarddir,
|
g_topdir, g_delim, g_delim, g_archdir, g_delim, g_chipdir,
|
||||||
g_delim, g_delim, g_configdir);
|
g_delim, g_boarddir, g_delim, g_delim, g_configdir);
|
||||||
debug("check_configdir: Checking configpath=%s\n", g_buffer);
|
debug("check_configdir: Checking configpath=%s\n", g_buffer);
|
||||||
|
|
||||||
if (!verify_optiondir(g_buffer))
|
if (!verify_optiondir(g_buffer))
|
||||||
@ -726,12 +806,12 @@ static void check_configdir(void)
|
|||||||
g_configpath = strdup(g_buffer);
|
g_configpath = strdup(g_buffer);
|
||||||
|
|
||||||
/* Get and verify the path to the scripts directory:
|
/* Get and verify the path to the scripts directory:
|
||||||
* boards/<boarddir>/scripts
|
* boards/<archdir>/<chipdir>/<boarddir>/scripts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%c%s%cscripts",
|
snprintf(g_buffer, BUFFER_SIZE, "%s%cboards%c%s%c%s%c%s%cscripts",
|
||||||
g_topdir, g_delim, g_delim, g_archdir, g_delim,
|
g_topdir, g_delim, g_delim, g_archdir, g_delim,
|
||||||
g_boarddir, g_delim);
|
g_chipdir, g_delim, g_boarddir, g_delim);
|
||||||
debug("check_configdir: Checking scriptspath=%s\n", g_buffer);
|
debug("check_configdir: Checking scriptspath=%s\n", g_buffer);
|
||||||
|
|
||||||
g_scriptspath = NULL;
|
g_scriptspath = NULL;
|
||||||
|
@ -135,7 +135,7 @@ else
|
|||||||
boarddir=`echo ${boardconfig} | cut -d':' -f1`
|
boarddir=`echo ${boardconfig} | cut -d':' -f1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to detect architecture for convenience.
|
# Detect the architecture of this board.
|
||||||
|
|
||||||
archs="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
archs="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
||||||
chips="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450
|
chips="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450
|
||||||
@ -168,8 +168,8 @@ if [ ! -d "${configpath}" ]; then
|
|||||||
configlist=`find ${TOPDIR}/boards -name defconfig`
|
configlist=`find ${TOPDIR}/boards -name defconfig`
|
||||||
for defconfig in ${configlist}; do
|
for defconfig in ${configlist}; do
|
||||||
config=`dirname ${defconfig} | sed -e "s,${TOPDIR}/boards/,,g"`
|
config=`dirname ${defconfig} | sed -e "s,${TOPDIR}/boards/,,g"`
|
||||||
boardname=`echo ${config} | cut -d'/' -f2`
|
boardname=`echo ${config} | cut -d'/' -f3`
|
||||||
configname=`echo ${config} | cut -d'/' -f4`
|
configname=`echo ${config} | cut -d'/' -f5`
|
||||||
echo " ${boardname}:${configname}"
|
echo " ${boardname}:${configname}"
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -115,6 +115,24 @@ fi
|
|||||||
# Detect the architecture of this board.
|
# Detect the architecture of this board.
|
||||||
|
|
||||||
ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
||||||
|
ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
||||||
|
CHIPLIST="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450
|
||||||
|
lpc17xx_40xx lpc214x lpc2378 lpc31xx lpc43xx lpc54xx max326xx moxart nrf52
|
||||||
|
nuc1xx sam34 sama5 samd2l2 samd5e5 samv7 stm32 stm32f0l0g0 stm32f7 stm32h7
|
||||||
|
stm32l4 str71x tiva tms570 xmc4 at32uc3 at90usb atmega mcs92s12ne64 pic32mx
|
||||||
|
pic32mz lm32 mor1kx m32262f8 sh7032 gap8 nr5m100 sim qemu esp32 z16f2811
|
||||||
|
ez80 z180 z8 z80"
|
||||||
|
|
||||||
|
for arch in ${ARCHLIST}; do
|
||||||
|
for chip in ${CHIPLIST}; do
|
||||||
|
if [ -f ${TOPDIR}/boards/${arch}/${chip}/${boarddir}/Kconfig ]; then
|
||||||
|
ARCHSUBDIR=${arch}
|
||||||
|
CHIPSUBDIR=${chip}
|
||||||
|
echo " Detected ${ARCHSUBDIR} Architecture"
|
||||||
|
echo " Detected ${CHIPSUBDIR} Chip"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
for arch in ${ARCHLIST}; do
|
for arch in ${ARCHLIST}; do
|
||||||
if [ -f boards/${arch}/${BOARDSUBDIR}/Kconfig ]; then
|
if [ -f boards/${arch}/${BOARDSUBDIR}/Kconfig ]; then
|
||||||
@ -144,7 +162,7 @@ fi
|
|||||||
|
|
||||||
WD=${PWD}
|
WD=${PWD}
|
||||||
|
|
||||||
BOARDDIR=boards/$ARCHSUBDIR/$BOARDSUBDIR
|
BOARDDIR=boards/$ARCHSUBDIR/$CHIPSUBDIR/$BOARDSUBDIR
|
||||||
SCRIPTSDIR=$BOARDDIR/scripts
|
SCRIPTSDIR=$BOARDDIR/scripts
|
||||||
MAKEDEFS1=$SCRIPTSDIR/Make.defs
|
MAKEDEFS1=$SCRIPTSDIR/Make.defs
|
||||||
|
|
||||||
|
@ -293,11 +293,22 @@ for line in $testlist; do
|
|||||||
# Detect the architecture of this board.
|
# Detect the architecture of this board.
|
||||||
|
|
||||||
ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
ARCHLIST="arm avr hc mips misoc or1k renesas risc-v sim x86 xtensa z16 z80"
|
||||||
|
CHIPLIST="a1x am335x c5471 cxd56xx dm320 efm32 imx6 imxrt kinetis kl lc823450
|
||||||
|
lpc17xx_40xx lpc214x lpc2378 lpc31xx lpc43xx lpc54xx max326xx moxart nrf52
|
||||||
|
nuc1xx sam34 sama5 samd2l2 samd5e5 samv7 stm32 stm32f0l0g0 stm32f7 stm32h7
|
||||||
|
stm32l4 str71x tiva tms570 xmc4 at32uc3 at90usb atmega mcs92s12ne64 pic32mx
|
||||||
|
pic32mz lm32 mor1kx m32262f8 sh7032 gap8 nr5m100 sim qemu esp32 z16f2811
|
||||||
|
ez80 z180 z8 z80"
|
||||||
|
|
||||||
for arch in ${ARCHLIST}; do
|
for arch in ${ARCHLIST}; do
|
||||||
if [ -f $nuttx/boards/${arch}/${boarddir}/Kconfig ]; then
|
for chip in ${CHIPLIST}; do
|
||||||
archdir=${arch}
|
if [ -f ${TOPDIR}/boards/${arch}/${chip}/${boarddir}/Kconfig ]; then
|
||||||
fi
|
archdir=${arch}
|
||||||
|
chipdir=${chip}
|
||||||
|
echo " Detected ${archdir} Architecture"
|
||||||
|
echo " Detected ${chipdir} Chip"
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "${archdir}" ]; then
|
if [ -z "${archdir}" ]; then
|
||||||
@ -305,7 +316,7 @@ for line in $testlist; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
path=$nuttx/boards/$archdir/$boarddir/configs/$configdir
|
path=$nuttx/boards/$archdir/$chipdir/$boarddir/configs/$configdir
|
||||||
if [ ! -r "$path/defconfig" ]; then
|
if [ ! -r "$path/defconfig" ]; then
|
||||||
echo "ERROR: no configuration found at $path"
|
echo "ERROR: no configuration found at $path"
|
||||||
showusage
|
showusage
|
||||||
|
Loading…
Reference in New Issue
Block a user