calloc returns null at91sam7s256
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
New
|
Undecided
|
Unassigned |
Bug Description
When I do first calloc after restart calloc returns null, when i debug my _sbrk_r func i see that newlib wants to allocate over 0x53bfdcf9 bytes. on old yagarto toolchain there are 0x218 bytes which seems to be ok and everything works fine. I assume this is toolchain bug.
45 void * _sbrk_r(
46 struct _reent *_s_r,
47 ptrdiff_t nbytes)
48 {
49 char *base; /* errno should be set to ENOMEM on error */
50
51 if (!heap_ptr) { /* Initialize if first time through. */
52 heap_ptr = end;
53 }
54 base = heap_ptr; /* Point to end of heap. */
55 heap_ptr += nbytes; /* Increase heap. */
56 DPRINTLN3("heap_ptr %x, base %x, nbytes %x", heap_ptr, base, nbytes);
57
58 return base; /* Return pointer to start of new heap area. */
59 }
it was my mistake _sbrk_r should take one argument, i don't know why two argument version works on older compilers over 3 years, please remove this bug.