Hi Kusti,
> while trying to optimize my code I was trying to get the compiler
> to place the internal variables into some non overlayed section with
> the '--preplace-udata-with' command line option but in all circumstances
> I've tried it results in one or more error messages of the following
> form:
>
> sdcc(6758) malloc: *** error for object 0x1eff1f: Non-aligned pointer
> being
> freed
> *** set a breakpoint in malloc_error_break to debug
This is caused by at_udata being initialized as
at_udata = "udata";
in conjunction with indirectly calling
Safe_free(at_udata)
on it just before assigning it ARG from --preplace-udata-with=ARG.
This can trivially be fixed using
at_udata = Safe_strdup("udata");
instead, but this wouldn't help you: at_udata is never used in the
compiler again ... This must be some ancient development help
(originating around 2004?!?) that never completely made it into
the official repository.
Though I have no workaround for the local register problem, you can
try to reduce BANKSELs by grouping global variables into a struct.
All struct members are considered to reside in the same bank, so this
could save you same instructions (if banksels are still a problem).
unsigned glo;
__data char *ptr;
with glo and ptr being often used together could be turned into
struct {
unsigned glo;
__data char *ptr;
} cluster0;
#define glo cluster0.glo
#define ptr cluster0.ptr
I did not test this, but guess it should help a bit (at the cost of
maintenability).
Best regards,
Raphael
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user