RES: Problem with simple 'new' operator when using RTEMS 4.11 for the SIS BSP

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 28 19:19:58 UTC 2014


On 07/28/2014 08:43 PM, Fabrício de Novaes Kucinskis wrote:
> The following example is enough to illustrate the problem I'm facing:
>   
> rtems_task Init(rtems_task_argument argument)
> {
>      int *var = new int[10];
>          
>      var[0] = 2;
>      printk("testing... %i", var[0]);
> }
>   
> If 'var' is allocated on the stack ("int var[10]"), the program runs ok.
> When using the 'new' operator (and hence using the heap), the execution
> doesn't achieve the Init task, stopping at some instruction inside
> _Thread_Start_multitasking() – that’s what I vaguely called ‘crash’ before,
> sorry for that.

A constant error source is the RTEMS configuration, so it is always good 
to have self-contained example and not some code snippet. I would always 
set a break point to _Terminate(), since this gives you a good hint in 
most cases.

You likely have not enough resources for the C++ basics, try to use

#define CONFIGURE_UNLIMITED_OBJECTS
#define CONFIGURE_UNIFIED_WORK_AREAS

for an easy start.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list