You could use a method similar to what has been used in m68k-amigaos C code to allocate long word aligned structures like FileInfoBlock from the stack:
@salass00 interesting idea - many thanks. For the first time I heard about constructor attribute. Looks nice, on weekend I will test.
Before you post this advice, I had in plan more dirty solution, something like: double Tarray[3]; double *pT,*pT1; pT= (double*)((long)(Tarray +1) - (long)(Tarray % 8)); pT1= pT+1;
Thx!
Edited by sailor on 2025/1/24 20:47:35 Edited by sailor on 2025/1/24 20:48:45 Edited by sailor on 2025/1/24 20:53:08 Edited by sailor on 2025/1/24 20:53:41
AmigaOS3: Amiga 1200 AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000 MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
You could use a method similar to what has been used in m68k-amigaos C code to allocate long word aligned structures like FileInfoBlock from the stack:
I could be wrong but I don't think definining a pointer to a multi-dimensional array will work. In my experience multi-dimensional arrays in C are quite limited in how they can be used so I almost never use them in my code.
What should work however is something like (not quite as elegant):
@flash native SPE version of gcc libraries will be fine, of course. NXP had CodeWarrior IDE for SPE in past, but there were other compiller than gcc. It will solve workarounds with float / double calls.
But global variable alignment error is probably directly in gcc - linking script error like salass00 said.
AmigaOS3: Amiga 1200 AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000 MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad
-1 ?? char does NOT add a extra 0\, its not a string, so why do you want on less char? a string is a class, not a array for chars.
This is code from salass00 hint (see above). If I understand it correctly, "-1" is here to allocate only needed memory, not more: allign_buffer should have size at least ( nr.of variables + 1 )*( sizeof(variable)) - we need to shift variable to correct aligned address. If variable is not correctly alligned, is shifted of certain nr. of bytes ( i.e. maximally of var.size -1 ). Shifting of var.size have no sense, because it have the same alignment like original. Thus we allocated one byte less. Of course, if var.size is less then 8 bytes, this shape should be corrected a little. Quote:
GCC should automatilcy allign data, and you can use compiler options for it, "packed".
Yes, in theory. Please, see post nr.53. Aligning not works always for global variables. In that case I need 8-byte alignment for experiments with SPE SIMD unit. And this workaround helps me much. This error is connected to gcc linker script ( see comment )
AmigaOS3: Amiga 1200 AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, AmigaOne X1000 MorphOS: Efika 5200b, Pegasos I, Pegasos II, Powerbook, Mac Mini, iMac, Powermac Quad