On Tue, Nov 03, 2020 at 03:34:46PM +0100, Bernd Walter wrote:
> On Mon, Nov 02, 2020 at 03:09:12PM +0100, Bernd Walter wrote:
> > On Mon, Nov 02, 2020 at 10:17:41AM -0300, Alan Carvalho de Assis wrote:
> > > This should be a better idea because you will have 32KB of RAM. They
> > > after getting it working you can remove not necessary features to
> > > eventually get it working reliable on 16KB RAM.
> 
> Ok - on the Zero and with predefined config (plus options to enable ADC and
> the workarround for the include files), it works.
> Have to see if the problem just didn't appear or if it is somehow related
> to my setup.

Wow - that was very unexpected.
I've stripped my code to nearly nothing.
Stack sizes had been restored to original NuttX values
board_app_initialize did (almost) nothing.
My main only called boardctl(BOARDIOC_INIT, 0); and then in config_init()
It hang in stat because of a broken inode table.

This is my config_init btw:
static
void
config_init()
{
#ifdef HAVE_W25
        FILE *f;
        ssize_t len;

        struct stat st;
        if (stat(CONFIGFILE, &st) == 0) {
                len = st.st_size;
                f = fopen(CONFIGFILE, "rb");
                if (f != NULL) {
                        syslog(LOG_NOTICE, "json reading %d bytes\n", len);
                        char *data = malloc(len + 1);
                        if (data != NULL) {
                                len = fread(data, 1, len, f);
                                if (len >= 0) {
                                        data[len] = '\0';
                                } else {
                                        free(data);
                                        data = NULL;
                                }
                        }
                        fclose(f);

                        if (data != NULL) {
                                syslog(LOG_NOTICE, "json data read: %s\n", 
data);
                                json_config = cJSON_Parse(data);
                                free(data);
                        }
                }
        }
#endif
        if (json_config == NULL) {
                syslog(LOG_NOTICE, "reseting json config\n");
                json_config = cJSON_CreateObject();
        }
}

Nothing fancy - HAVE_W25 was set, but the mounting code in
board_app_initialize() disabled.

And then there it was, the only thing left in board_app_initialize():
printf("test\n\r");

I do not have a console and obviously stdio wasn't linked to /dev/null.
This wasn't a problem on my other console less board using older NuttX, but
with memory corruption I also just might have been lucky.

Is there any example on how to link /dev/null?

-- 
B.Walter <be...@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.

Reply via email to