Comments (6)
Just a addendum as is expected by the timer:sleep()
test also
receive after 10000 -> timeout end
Takes 20s instead of 10
from grisp-software.
Added the folwing code snippet during system startup in the Init task before Erlang is started:
printf("before sleep");
sleep(10);
printf("after sleep");
This sleep takes almost 30s so even more. I get the impression this has nothing to do with our Erlang port but the RTEMS BSP needs to fix the time.
BTW we found out that Erlang uses https://www.freebsd.org/cgi/man.cgi?query=clock_gettime to ask the OS for time mostly. Also the timeouts in the select()
call should work precisely since that is used by the Erlang VM whenever it needs to wait for I/O or time passed. Thats just additional info on what to maybe test with didn't check how much these times are off after sleep()
already failed.
The configuration we start the system with can be at the end of:
https://github.com/grisp/grisp/blob/master/grisp/grisp_base/sys/erl_main.c
from grisp-software.
Hello @peerst,
I had a similar problem on another atsamv based board and I'm currently trying to fix it: A sleep(1) needs a lot longer than 1 second but only if no debugger is connected.
The reason behind it seems to be that the wall clock on the atsamv is implemented based on a counter in the ARM DWT block. This should be a free running counter but it seems that it stops on a WFI (wait for interrupt) instruction. The WFI is used in the idle loop.
Could you try to add the following workaround to your applications configuration:
/* Workarround for problem that the wait instruction in the default idle body
* has an influence on the cycle counter that is used for the wall clock. */
void *_My_Idle_body(uintptr_t ignored)
{
for( ; ; ) ;
return 0; /* to avoid warning */
}
#define CONFIGURE_IDLE_TASK_BODY _My_Idle_body
If that works, that is the same problem.
Regards
Christian
from grisp-software.
Hi @c-mauderer added this snippet and it definitely changed something.
But now a sleep(10)
only sleeps 8 Seconds
from grisp-software.
Well while sleep()
on the C level seems to still behave weirdly the workaround definitely fixes Erlangs notion of time:
(grisp@base0006)5> T1 = erlang:now().
{567,996917,409432}
wait 100s ...
(grisp@base0006)6> T2 = erlang:now().
{567,997017,588033}
(grisp@base0006)7>
(grisp@base0006)9> timer:now_diff(T2, T1)/1000000.
100.178601
from grisp-software.
Hello @peerst,
the problem is now fixed in the upstream RTEMS. To keep the impact small for you, I cherry-picked the patch onto the current GRiSP branch of RTEMS. As soon as you update the grisp-software repo to the current master and rebuild RTEMS, you shouldn't need the workarround any more.
Regards
Christian
from grisp-software.
Related Issues (20)
- Updating the booloader on macOS 10.13.1 HOT 2
- Build fails on Mac OS 10.10.5 HOT 17
- Built-in shell hangs after editing file HOT 2
- Building grisp project failing on Mac OS 10.10.5 HOT 3
- GCC no longer builds on macOS 10.13 HOT 1
- Issue with the provided udev rules. HOT 3
- Debugging symbols missing when trying to debug the beam with gdb and supports script. HOT 4
- Question: when building toolchain, is there a way to re-use build artifacts? HOT 2
- Debugging with OpenOCD/GDB is not working. HOT 4
- OpenOCD no longer builds on GCC7
- Usage of PIO_ConfigureIt() leads to wpa_supplicant not starting HOT 8
- git.rtems.org down: rtems-sourcebuilder sub-module reference points to nonexisting changeset HOT 11
- Testsuite build: undefined reference to `_bsd_at91_mci_nexusmodule_sys_init' HOT 2
- When wpa_supplicant is not configure but Wifi enable it connects to the first unencrypted network
- Consider hosting rtems toolchain build-dependencies on GitHub HOT 13
- OpenOCD does not build with gcc 7.3.1 HOT 1
- Add instructions of how to create custom RTEMS binaries
- Missing Licence HOT 7
- Device will sometimes not boot
- Build fails on MacOS 10.15 Catalina HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grisp-software.