configs/olimex-stm32_p407: Add logic to support initialization of the kernel module symbol table installed in the pass2/ directory during the application phase of the build. The kmodule configuration appears to be fully functional.

This commit is contained in:
Gregory Nutt 2018-08-07 10:50:25 -06:00
parent 4becaea8e3
commit a2428db499
5 changed files with 38 additions and 24 deletions

View File

@ -333,12 +333,9 @@ must be is one of the following.
kelf configuration, the logic in apps/example/module will wait on power kelf configuration, the logic in apps/example/module will wait on power
up until the USB FLASH driver has been inserted and initialized. up until the USB FLASH driver has been inserted and initialized.
STATUS: There is an issue that makes this configuration unusable at the STATUS:
present time: The symbol table is built by apps/examples/module/drivers/Makefile 2018-08-07: After some struggle, the configuration appears to be
in user space. The problem with that is that the kernel module does reference working correctly.
internal kernel symbols which are not available in the user space build context.
A mechanism is needed in the build system to build the symbol table in the
context of the kernel. There is currently no way to do that.
knsh: knsh:

View File

@ -9,24 +9,10 @@ CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_USEBASEPRI=y CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_ARM_MPU=y CONFIG_ARM_MPU=y
CONFIG_BOARD_INITIALIZE=y
CONFIG_BOARD_INITTHREAD=y
CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILD_PROTECTED=y CONFIG_BUILD_PROTECTED=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_BINFMT=y
CONFIG_DEBUG_BINFMT_ERROR=y
CONFIG_DEBUG_BINFMT_WARN=y
CONFIG_DEBUG_CUSTOMOPT=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FS=y
CONFIG_DEBUG_FS_ERROR=y
CONFIG_DEBUG_FS_WARN=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_USB=y
CONFIG_DEBUG_USB_ERROR=y
CONFIG_DEBUG_USB_WARN=y
CONFIG_DEBUG_WARN=y
CONFIG_EXAMPLES_MODULE=y CONFIG_EXAMPLES_MODULE=y
CONFIG_EXAMPLES_MODULE_DEVPATH="/dev/sda" CONFIG_EXAMPLES_MODULE_DEVPATH="/dev/sda"
CONFIG_EXAMPLES_MODULE_FSREMOVEABLE=y CONFIG_EXAMPLES_MODULE_FSREMOVEABLE=y
@ -34,7 +20,6 @@ CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y
CONFIG_INTELHEX_BINARY=y CONFIG_INTELHEX_BINARY=y
CONFIG_LIB_BOARDCTL=y CONFIG_LIB_BOARDCTL=y
CONFIG_MAX_TASKS=16 CONFIG_MAX_TASKS=16

View File

@ -62,6 +62,7 @@
#define HAVE_USBHOST 1 #define HAVE_USBHOST 1
#define HAVE_USBMONITOR 1 #define HAVE_USBMONITOR 1
#define HAVE_ELF 1 #define HAVE_ELF 1
#define HAVE_MODSYMS 1
/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support /* Can't support MMC/SD features if mountpoints are disabled or if SDIO support
* is not enabled. * is not enabled.
@ -131,6 +132,17 @@
# undef HAVE_ELF # undef HAVE_ELF
#endif #endif
/* Module symbol table */
#if !defined(CONFIG_EXAMPLES_MODULE) || defined(CONFIG_BUILD_FLAT)
# undef HAVE_MODSYMS
#endif
#ifdef HAVE_MODSYMS
# define MODSYMS_NSYMBOLS_VAR g_mod_nexports
# define MODSYMS_SYMTAB_ARRAY g_mod_exports
#endif
/* Olimex-STM32-P407 GPIOs **************************************************/ /* Olimex-STM32-P407 GPIOs **************************************************/
/* LEDs */ /* LEDs */

View File

@ -54,6 +54,11 @@
# include <nuttx/usb/usbmonitor.h> # include <nuttx/usb/usbmonitor.h>
#endif #endif
#ifdef CONFIG_MODULE
# include "nuttx/symtab.h"
# include "nuttx/lib/modlib.h"
#endif
#ifdef CONFIG_STM32_OTGFS #ifdef CONFIG_STM32_OTGFS
# include "stm32_usbhost.h" # include "stm32_usbhost.h"
#endif #endif
@ -61,6 +66,15 @@
#include "stm32.h" #include "stm32.h"
#include "olimex-stm32-p407.h" #include "olimex-stm32-p407.h"
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef HAVE_MODSYMS
extern const struct symtab_s MODSYMS_SYMTAB_ARRAY[];
extern const int MODSYMS_NSYMBOLS_VAR;
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -96,6 +110,12 @@ int stm32_bringup(void)
} }
#endif #endif
#ifdef HAVE_MODSYMS
/* Install the module symbol table */
modlib_setsymtab(MODSYMS_SYMTAB_ARRAY, MODSYMS_NSYMBOLS_VAR);
#endif
#ifdef HAVE_ELF #ifdef HAVE_ELF
/* Initialize the ELF binary loader */ /* Initialize the ELF binary loader */

View File

@ -70,7 +70,7 @@
* Name: mod_dumploadinfo * Name: mod_dumploadinfo
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_DEBUG_INFO) && defined(CONFIG_DEBUG_BINFMT) #ifdef CONFIG_DEBUG_BINFMT_INFO
static void mod_dumploadinfo(FAR struct mod_loadinfo_s *loadinfo) static void mod_dumploadinfo(FAR struct mod_loadinfo_s *loadinfo)
{ {
int i; int i;