Can printf() be made SMP safe?

Joel Sherrill joel at rtems.org
Fri Apr 30 20:21:41 UTC 2021


On Fri, Apr 30, 2021 at 2:07 PM Dave DeGroote <Dave.DeGroote at astrobotic.com>
wrote:

> Hello,
>
> I'm trying to get RTEMS running using SMP on a Leon3/gr712rc (2 cores). I
> have it partially running, but it crashes intermittently on printf's.  Can
> anyone tell me if there's a way to make printf() SMP safe?  printf appears
> to use termios which uses rtems_mutex_init() and
> rtems_binary_semaphore_init() which I don't think are SMP safe (but I'm
> also new to this so I'm not sure).
>

Those are SMP safe. I suspect you are using the Classic API (e.g.
rtems_task_) and by default they do not have floating point enabled. You
probably just need to enable the floating point attribute on the task
create calls (or for the init task).

https://docs.rtems.org/branches/master/c-user/task/directives.html#rtems-task-create

See configuring a system chapter for the init task setting.

If you provide the exception, we would know for sure.

--joel

>
> Thanks!
>
> [image: Astrobotic Logo] *Dave DeGroote*
>
> Flight Software Engineer
>
> *Astrobotic*
>
> 1016 N. Lincoln Avenue  |  Pittsburgh, PA 15233
>
> office: 412.682.3282
>
>
>
>
>
> *Disclaimer*
>
> The information contained in this communication from the sender is
> confidential. It is intended solely for use by the recipient and others
> authorized to receive it. If you are not the recipient, you are hereby
> notified that any disclosure, copying, distribution or taking action in
> relation of the contents of this information is strictly prohibited and may
> be unlawful.
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20210430/5537a75c/attachment.html>


More information about the users mailing list