Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example blinking_lwip not working: example triggers ErrorHook() #432

Closed
mabeett opened this issue Jul 6, 2016 · 7 comments
Closed

example blinking_lwip not working: example triggers ErrorHook() #432

mabeett opened this issue Jul 6, 2016 · 7 comments

Comments

@mabeett
Copy link
Contributor

mabeett commented Jul 6, 2016

The blinking_lwip example does not work fine on ciaa_nxp. The code is build and downloaded normally.
When the board runs the code the led blinks but there is no activity related with ethernet task. (no ping responses, no echo tcp).

If the user sets ERRORHOOK = FALSE; in the oil, the example works as usually.

diff --git a/examples/blinking_lwip/etc/blinking_lwip.oil b/examples/blinking_lwip/etc/blinking_lwip.oil
index 70eac73..10b801e 100644
--- a/examples/blinking_lwip/etc/blinking_lwip.oil
+++ b/examples/blinking_lwip/etc/blinking_lwip.oil
@@ -45,7 +45,7 @@ OSEK OSEK {

 OS ExampleOS {
     STATUS = EXTENDED;
-    ERRORHOOK = TRUE;
+    ERRORHOOK = FALSE;
     PRETASKHOOK = FALSE;
     POSTTASKHOOK = FALSE;
     STARTUPHOOK = FALSE;
@mabeett
Copy link
Contributor Author

mabeett commented Jul 8, 2016

Setting ERRORHOOK = TRUE; and deleting ShutdownOS(0); from void ErrorHook() the system seems working properly.

diff --git a/examples/blinking_lwip/src/blinking_lwip.c b/examples/blinking_lwip/src/blinking_lwip.c
index 37cca3e..d401bc8 100644
--- a/examples/blinking_lwip/src/blinking_lwip.c
+++ b/examples/blinking_lwip/src/blinking_lwip.c
@@ -100,7 +100,7 @@ void ErrorHook(void)
 {^M
    ciaaPOSIX_printf("ErrorHook was called\n");^M
    ciaaPOSIX_printf("Service: %d, P1: %d, P2: %d, P3: %d, RET: %d\n", OSErrorGetServiceId(), OSErrorGetParam1(), OSErrorGetParam2(), OSErrorGetParam3(), OSErrorGetRet());^M
-   ShutdownOS(0);^M
+//   ShutdownOS(0);^M
 }^M
 ^M
 TASK(InitTask)^M

@mcerdeiro
Copy link
Contributor

Hola Matías,

Con los cambios que hiciste no está funcionando bien. Esta funcionando mal
pero lo ignoras y por eso parece andar.

Deja el código como estaba. Pone un breakpoint en error hook y fijate los
valores de los parámetros que recibe error hook. También podes mirar el
stock trace..

Eso te va a dar una idea o me decís y yo te digo cual es el error.

ErrorHook va cuando hay una excepción y vos lo que hiciste fue de alguna
forma deshabilitar las excepciones. El problema sigue.

Se entiende?

Saludos
Mariano
Am 08.07.2016 5:46 AM schrieb "MAbeeTT (Matías Pecchia)" <
notifications@github.com>:

Setting ERRORHOOK = TRUE; and deleting ShutdownOS(0); from void ErrorHook()
the system seems working properly.

diff --git a/examples/blinking_lwip/src/blinking_lwip.c
b/examples/blinking_lwip/src/blinking_lwip.c
index 37cca3e..d401bc8 100644---
a/examples/blinking_lwip/src/blinking_lwip.c+++
b/examples/blinking_lwip/src/blinking_lwip.c@@ -100,7 +100,7 @@ void
ErrorHook(void)
{^M
ciaaPOSIX_printf("ErrorHook was called\n");^M
ciaaPOSIX_printf("Service: %d, P1: %d, P2: %d, P3: %d, RET: %d\n",
OSErrorGetServiceId(), OSErrorGetParam1(), OSErrorGetParam2(),
OSErrorGetParam3(), OSErrorGetRet());^M- ShutdownOS(0);^M+//
ShutdownOS(0);^M
}^M
^M
TASK(InitTask)^M


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#432 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AG7km1nJDPnw5RunlziGul1lR0YPv5m0ks5qTcgwgaJpZM4JGKUD
.

@cpantel
Copy link
Contributor

cpantel commented Jul 8, 2016

BTW, los ^M se pueden detectar con
https://github.com/ciaa/Firmware/blob/feature/coding_style/modules/tools/scripts/check_crlf.sh

y eliminar con

https://github.com/ciaa/Firmware/blob/feature/coding_style/modules/tools/scripts/fix_crlf.sh
Saludos

-- Carlos Pantelides @dev4sec http://seguridad-agile.blogspot.com/

diff --git a/examples/blinking_lwip/src/blinking_lwip.c
b/examples/blinking_lwip/src/blinking_lwip.c
index 37cca3e..d401bc8 100644---
a/examples/blinking_lwip/src/blinking_lwip.c+++
b/examples/blinking_lwip/src/blinking_lwip.c@@ -100,7 +100,7 @@ void
ErrorHook(void)
{^M
ciaaPOSIX_printf("ErrorHook was called\n");^M
ciaaPOSIX_printf("Service: %d, P1: %d, P2: %d, P3: %d, RET: %d\n",
OSErrorGetServiceId(), OSErrorGetParam1(), OSErrorGetParam2(),
OSErrorGetParam3(), OSErrorGetRet());^M- ShutdownOS(0);^M+//
ShutdownOS(0);^M
}^M
^M
TASK(InitTask)^M

@mabeett
Copy link
Contributor Author

mabeett commented Jul 8, 2016

Sí, eso veía, pero no llegué a escribirlo, me ganó el sueño. Me confundía que el ShutdownOS(0); no detiene a la placa (la tarea del parpadeo continua funcionando. Eso pasa porque el hook de shutodown está en false. No obstante poniendolo en true no está implemenatado el shutdown para la placa y falla en tiempo de compilación.
Lo que me indicás lo comprendo, voy a ver si llego a algo útil.

@mabeett
Copy link
Contributor Author

mabeett commented Jul 8, 2016

@cpantel entiendo, no estoy interesado en higienizar el código, los ^M vienen desde otros commits, el archivo está escrito a la manera de DOS y vim lo sigue escribiendo como lo leyó. Si cambio todo el archivo a UNIX no será visible lo que intervenga, es por eso que me parece mejor que un commit haga cambio de codificación y otro intervenga sobre la lógica del código.

No obstante la comparación entre commits anteriores y posteriores de la higiene de código arrojará diferencias de este cambio de codificación más los cambios en la lógica, será (casi) imposible saber qué cambios en la lógica hicieron entre esas dos versiones post y pre fix_crlf.sh

Si escribiera un nuevo archivo sería a la manera de UNIX, porque así lo hace vim en linux ;)

@mabeett
Copy link
Contributor Author

mabeett commented Jul 8, 2016

Apparently the was related with posix semaphores.
capture

When lwip calls malloc(), it ciaaPOSIX_malloc()is executed.

This patch may solve the problem.

--- a/examples/blinking_lwip/etc/blinking_lwip.oil
+++ b/examples/blinking_lwip/etc/blinking_lwip.oil
@@ -76,9 +77,12 @@ TASK InitTask {
 TASK PeriodicTask {
     PRIORITY = 1;
     ACTIVATION = 1;
     STACK = 2048;
     TYPE = BASIC;
     SCHEDULE = FULL;
+    RESOURCE = POSIXR;
 }

 TASK BlinkTask {

@mabeett mabeett changed the title example blinking_lwip not working example blinking_lwip not working: example triggers ErrorHook() Jul 8, 2016
mabeett added a commit to mabeett/Firmware that referenced this issue Jul 8, 2016
mcerdeiro added a commit that referenced this issue Jul 10, 2016
…rs-errorhook

bugfix #432 RESOURCE = POSIXR for blinkink_lwip example
@mabeett
Copy link
Contributor Author

mabeett commented Jul 10, 2016

solved in #434

@mabeett mabeett closed this as completed Jul 10, 2016
@mcerdeiro mcerdeiro added this to the ciaaFirmware 1.1.0 milestone Jul 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants