diff --git a/.gitmodules b/.gitmodules index 3e6f1b9..7f854c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,11 @@ [submodule "rtems"] path = rtems - url = https://github.com/grisp/rtems - branch = grisp-20171025-patches + url = git://git.rtems.org/rtems.git + branch = master [submodule "rtems-libbsd"] path = rtems-libbsd - url = https://github.com/grisp/rtems-libbsd - branch = grisp + url = git://git.rtems.org/rtems-libbsd.git + branch = 5-freebsd-12 [submodule "rtems-source-builder"] path = rtems-source-builder url = git://git.rtems.org/rtems-source-builder.git diff --git a/build/build-libbsd.sh b/build/build-libbsd.sh index 9e1d5a9..df50cc7 100755 --- a/build/build-libbsd.sh +++ b/build/build-libbsd.sh @@ -14,6 +14,8 @@ PROJECTDIR="${SCRIPTDIR}/../" . "${SCRIPTDIR}/configuration.sh" export PATH="${PREFIX}/bin:${PATH}" +WAF="${PROJECTDIR}/rtems-libbsd/waf" + cd "${LIBBSD_SOURCE_DIR}" if [ "$BSP_NAME" = "atsamv" ] @@ -55,14 +57,15 @@ then fi fi -waf configure \ +python3 $WAF configure \ --prefix="${PREFIX}" \ - --rtems-bsps="${RTEMS_CPU}/${BSP_NAME}" -waf + --rtems-bsps="${RTEMS_CPU}/${BSP_NAME}" \ + --buildset="${SCRIPTDIR}/libbsd-buildset.ini" +python3 $WAF if [ $DO_INSTALL -ne 0 ] then - waf install + python3 $WAF install fi if [ "$BSP_NAME" = "atsamv" ] diff --git a/build/libbsd-buildset.ini b/build/libbsd-buildset.ini new file mode 100644 index 0000000..976028e --- /dev/null +++ b/build/libbsd-buildset.ini @@ -0,0 +1,11 @@ +[general] +name = grisp +extends = default.ini + +[modules] +# WiFi +dev_usb_wlan = on +dev_wlan_rtwn = on +net80211 = on +user_space_wlanstats = on +usr_sbin_wpa_supplicant = on diff --git a/grisp-sd-sample/Makefile b/grisp-sd-sample/Makefile index 6cba19e..b095f26 100644 --- a/grisp-sd-sample/Makefile +++ b/grisp-sd-sample/Makefile @@ -17,7 +17,7 @@ $(BUILDDIR): mkdir $(BUILDDIR) $(APP).exe: $(APP_OBJS) - $(CCLINK) $^ -lgrisp -lbsd -lm -o $@ + $(CCLINK) $^ -lgrisp -lftpd -lbsd -lm -o $@ $(APP).bin: $(APP).exe $(OBJCOPY) -O binary $^ $@ diff --git a/grisp-sd-sample/init.c b/grisp-sd-sample/init.c index 8c0ecb3..fcec756 100644 --- a/grisp-sd-sample/init.c +++ b/grisp-sd-sample/init.c @@ -47,13 +47,14 @@ #include #include +#include #include #include #include -#define STACK_SIZE_INIT_TASK (64 * 1024) -#define STACK_SIZE_SHELL (64 * 1024) +#define STACK_SIZE_INIT_TASK (16 * 1024) +#define STACK_SIZE_SHELL (16 * 1024) #define PRIO_SHELL 150 #define PRIO_LED_TASK (RTEMS_MAXIMUM_PRIORITY - 1) @@ -186,9 +187,9 @@ Init(rtems_task_argument arg) grisp_led_set1(false, false, false); grisp_led_set2(true, false, false); puts("\nGRISP RTEMS SD Demo\n"); - grisp_init_sd_card(); grisp_init_lower_self_prio(); grisp_init_libbsd(); + grisp_init_sd_card(); /* Wait for the SD card */ grisp_led_set2(true, false, true); diff --git a/libgrisp/src/init.c b/libgrisp/src/init.c index 8016835..9510e12 100644 --- a/libgrisp/src/init.c +++ b/libgrisp/src/init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016, 2018 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -37,12 +37,11 @@ #include #include -#include - #include #include #include #include +#include #include #include #include @@ -149,74 +148,29 @@ grisp_init_sd_card(void) assert(sc == RTEMS_SUCCESSFUL); } -static void -grisp_init_network_ifconfig_lo0(void) -{ - int exit_code; - char *lo0[] = { - "ifconfig", - "lo0", - "inet", - "127.0.0.1", - "netmask", - "255.255.255.0", - NULL - }; - char *lo0_inet6[] = { - "ifconfig", - "lo0", - "inet6", - "::1", - "prefixlen", - "128", - "alias", - NULL - }; - - exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0); - assert(exit_code == EX_OK); - - exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6); - assert(exit_code == EX_OK); -} - -static void -network_dhcpcd_task(rtems_task_argument arg) -{ - int exit_code; - const char *cconf = (const char*) arg; - char* conf = NULL; - if (cconf && (access(cconf, F_OK | R_OK ) != -1) && (conf = strdup(cconf))) { - char *dhcpcd[] = {"dhcpcd", "-f", conf, NULL}; - exit_code = rtems_bsd_command_dhcpcd(RTEMS_BSD_ARGC(dhcpcd), dhcpcd); - free(conf); - } else { - char *dhcpcd[] = {"dhcpcd", NULL}; - exit_code = rtems_bsd_command_dhcpcd(RTEMS_BSD_ARGC(dhcpcd), dhcpcd); - } - - assert(exit_code == EXIT_SUCCESS); - - rtems_task_delete(RTEMS_SELF); -} - void -grisp_init_dhcpcd_with_config(rtems_task_priority prio, const char *conf) +grisp_init_dhcpcd_with_config(rtems_task_priority prio, const char *cfile) { + rtems_dhcpcd_config config; rtems_status_code sc; - rtems_id id; - - sc = rtems_task_create( - rtems_build_name('D', 'H', 'C', 'P'), - prio, - 2 * RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_FLOATING_POINT, - &id - ); - assert(sc == RTEMS_SUCCESSFUL); + int argc = 1; + char *argv[] = {"dhcpcd", NULL, NULL, NULL}; + char *file = NULL; + + if (cfile != NULL && access(cfile, F_OK | R_OK ) == 0 && + (file = strdup(cfile))) { + argc = 3; + argv[1] = "-f"; + argv[2] = file; + } + + memset(&config, 0, sizeof(config)); + config.priority = prio; + config.argc = argc; + config.argv = argv; - sc = rtems_task_start(id, network_dhcpcd_task, (rtems_task_argument) conf); + sc = rtems_dhcpcd_start(&config); + free(file); assert(sc == RTEMS_SUCCESSFUL); } @@ -230,13 +184,15 @@ void grisp_init_libbsd(void) { rtems_status_code sc; + int exit_code; grisp_saf1761_basic_init(); sc = rtems_bsd_initialize(); assert(sc == RTEMS_SUCCESSFUL); - grisp_init_network_ifconfig_lo0(); + exit_code = rtems_bsd_ifconfig_lo0(); + assert(exit_code == EX_OK); grisp_wlan_power_up(); /* Let the callout timer allocate its resources */ @@ -363,3 +319,19 @@ grisp_wlan_power_down(void) const Pin wlan_en = GRISP_WLAN_EN; PIO_Set(&wlan_en); } + +rtems_task_priority +rtems_bsd_get_task_priority(const char *name) +{ + + (void)name; + return (100); +} + +size_t +rtems_bsd_get_task_stack_size(const char *name) +{ + + (void)name; + return 8 * 1024; +} diff --git a/libgrisp/src/init_wpa.c b/libgrisp/src/init_wpa.c index 4991c8e..f0b9483 100644 --- a/libgrisp/src/init_wpa.c +++ b/libgrisp/src/init_wpa.c @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/rtems b/rtems index 8b5a801..7a1934d 160000 --- a/rtems +++ b/rtems @@ -1 +1 @@ -Subproject commit 8b5a801e85e273aa9778bbf5b41269ae15fceb30 +Subproject commit 7a1934dac087295b209563d984549a48728599a3 diff --git a/rtems-libbsd b/rtems-libbsd index ef5d536..eb1d30a 160000 --- a/rtems-libbsd +++ b/rtems-libbsd @@ -1 +1 @@ -Subproject commit ef5d536f840e01cb7a9edfd9f72dd0f058fb62aa +Subproject commit eb1d30ad351ed18116acbd8b224ed8e07d6627d0 diff --git a/rtems-source-builder b/rtems-source-builder index 8ee4e8c..9c825f0 160000 --- a/rtems-source-builder +++ b/rtems-source-builder @@ -1 +1 @@ -Subproject commit 8ee4e8cd557c25fca59bb9751751ad4172530958 +Subproject commit 9c825f0b9a4eff4f87d22e12d3c94072712c3918