Update examples/module and system/symtab to adjust to change in boardctl() and insmod() interfaces
This commit is contained in:
parent
469a7fdf0f
commit
d198f09ae3
@ -6,6 +6,8 @@
|
|||||||
config EXAMPLES_MODULE
|
config EXAMPLES_MODULE
|
||||||
bool "Module Example"
|
bool "Module Example"
|
||||||
default n
|
default n
|
||||||
|
depends on MODULE && LIB_BOARDCTL
|
||||||
|
select BOARDCTL_OS_SYMTAB
|
||||||
---help---
|
---help---
|
||||||
Enable the module example
|
Enable the module example
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
#include <sys/boardctl.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -122,11 +123,23 @@ int main(int argc, FAR char *argv[])
|
|||||||
int module_main(int argc, char *argv[])
|
int module_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
struct boardioc_symtab_s symdesc;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
ssize_t nbytes;
|
ssize_t nbytes;
|
||||||
int ret;
|
int ret;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
/* Set the OS symbol table indirectly through the boardctl() */
|
||||||
|
|
||||||
|
symdesc.symtab = exports;
|
||||||
|
symdesc.nsymbols = nexports;
|
||||||
|
ret = boardctl(BOARDIOC_OS_SYMTAB, (uintptr_t)&symdesc);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: boardctl(BOARDIOC_OS_SYMTAB) failed: %d\n", ret);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a ROM disk for the ROMFS filesystem */
|
/* Create a ROM disk for the ROMFS filesystem */
|
||||||
|
|
||||||
printf("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_MODULE_DEVMINOR);
|
printf("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_MODULE_DEVMINOR);
|
||||||
@ -153,7 +166,7 @@ int module_main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Install the character driver */
|
/* Install the character driver */
|
||||||
|
|
||||||
ret = insmod(MOUNTPT "/chardev", "chardev", exports, nexports);
|
ret = insmod(MOUNTPT "/chardev", "chardev");
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: insmod failed: %d\n", ret);
|
fprintf(stderr, "ERROR: insmod failed: %d\n", ret);
|
||||||
|
@ -7,7 +7,7 @@ config SYSTEM_SYMTAB
|
|||||||
bool "User-provided symbol table"
|
bool "User-provided symbol table"
|
||||||
default n
|
default n
|
||||||
depends on EXECFUNCS_HAVE_SYMTAB && LIB_BOARDCTL
|
depends on EXECFUNCS_HAVE_SYMTAB && LIB_BOARDCTL
|
||||||
select BOARDCTL_SYMTAB
|
select BOARDCTL_APP_SYMTAB
|
||||||
---help---
|
---help---
|
||||||
Build and include default symbol table in the NuttX application.
|
Build and include default symbol table in the NuttX application.
|
||||||
The symbol table is selected by call symtab_initialize(). The
|
The symbol table is selected by call symtab_initialize(). The
|
||||||
|
@ -73,7 +73,7 @@ void symtab_initialize(void)
|
|||||||
|
|
||||||
symdesc.symtab = g_symtab;
|
symdesc.symtab = g_symtab;
|
||||||
symdesc.nsymbols = NSYMBOLS;
|
symdesc.nsymbols = NSYMBOLS;
|
||||||
(void)boardctl(BOARDIOC_SYMTAB, (uintptr_t)&symdesc);
|
(void)boardctl(BOARDIOC_APP_SYMTAB, (uintptr_t)&symdesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SYSTEM_SYMTAB */
|
#endif /* CONFIG_SYSTEM_SYMTAB */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user