bladox.com Forum Index bladox.com
Turbo SIM Toolkit Adapter Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug: initializers not working

 
Post new topic   Reply to topic    bladox.com Forum Index -> Development
View previous topic :: View next topic  
Author Message
jacko



Joined: 20 Dec 2010
Posts: 19

PostPosted: Tue Feb 15, 2011 10:17 am    Post subject: Bug: initializers not working Reply with quote

Hello,

In a function I do the following :

void test()
{
const u8 test_single = 0x3F;
const u8 test_multiple[] = { 0x3F, 0x00, 0x11, 0x22, 0x33, 0x44 };

dbch(test_single); dbc('\n');
for (u8 i=0; i<6; i++)
dbch(test_multiple[i]);
}

The output is something like
3f
606f42f4bf

It looks like there is a low level bug which prevent the tables from being initialized or programmed properly.

This looks like a severe bug; I am using the precompiled toolchain from Bladox on Linux (avr1.tgz), with a Makefile I got from Bladox samples too.

Any idea?
Back to top
View user's profile Send private message
pz



Joined: 12 Mar 2004
Posts: 1161

PostPosted: Tue Feb 15, 2011 5:13 pm    Post subject: Reply with quote

It's a feature, not bug.

Use u8 PROGMEM t_test_multiple[] = { 0x3F, 0x00, 0x11, 0x22, 0x33, 0x44 }; out off the call to store it in flash. Then explicitly init the array with memcpy().
Back to top
View user's profile Send private message
jacko



Joined: 20 Dec 2010
Posts: 19

PostPosted: Wed Feb 16, 2011 8:31 am    Post subject: Reply with quote

pz wrote:
It's a feature, not bug.


Well, you should really document that "feature" somewhere, because it is not compliant with the C standard, and the compiler (nor objdump --turbo) does not emit any warning.

Is there a page somewhere that lists that sort of limitations ?

I have no problems with limitations such as this one, unless they are not documented and the compiler does not show any error...

As a result, use of any library which uses that feature (which is authorized by the C standard) will not work correctly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group