Show Posts
Pages: 1 ... 62 63 [64] 65 66 ... 122
946  Using Arduino / Programming Questions / Re: Help create maxSize sketch on: January 18, 2013, 07:07:53 pm
I use 1.5.1r2 and I'm pretty sure its GCC is 4.3.2.

I do not get errors, but yeah, the unused PROGMEM data is not removed. The missing bytes seem accounted for with 8x 16-bit pointers, and 6-bytes for each volatile load copy and save.

I'm not sure weather this is a bug ( or what you are pointing out ) as the flash read functions should be able to do arbitrary reading. And I guess not holding onto a pointer saves ram. Maybe there is a way using sections to place progmem data where you want.
947  Community / Exhibition / Gallery / Re: Portable console on: January 18, 2013, 09:25:19 am
Quote
If you are still / were considering a big screen project, I'm working on a library for a 3.2" on a mega 2560
@pYro_65 : The mega 2560 has more flash, more ram (good for gaming), more pins (to connect a 16b parallel screen instead of SPI) and you can adress external ram (yeaaaaah). But it's very, very expensive compared to a atmega 328. That's why I chose to do a cheap gaming platform first (to practice PCB routing too), and maybe later, if I want  more power, I'll move on ARM 80Mhz 32bit stuff (but it's very difficult to hand solder).

That's understandable, If you find an AVR you like my library is easily transposable to any 8 bit AVR with at least 2x 8-bit wide IO ports. With a little modification it can support non-parallel interfaces, a large amount of speed will be lost, but will still be optimal.
The 1284 for example, has 16k ram and is available in through hole. From maniacbugs site it appears it has 2 free ports and is less than half the price of the 2560.

Anyway I shouldn't advertise my library until I release it, I'm just keen to do some collaborative work. A game is the fundamental reason behind my need for a new graphics driver. So keep that in mind if you ever re-ignite your project.
948  Using Arduino / Programming Questions / Re: Help create maxSize sketch on: January 18, 2013, 05:25:06 am
Yes that is why my version used a few declarations instead of one, 500 max nested template instantiations and a max variable size of ( ( 1<< 16 ) / 2 ) - 1

There is compiler options to enlarge both I think.
949  Using Arduino / Programming Questions / Re: Help create maxSize sketch on: January 17, 2013, 11:07:45 pm
Is that what that PROGMEM syntax is actually doing ?

What is your question referencing?

PROGMEM is causing variables marked with it to have their data stored in flash and as a result are constant, as opposed to normal variables which reside in sram.
950  Community / Exhibition / Gallery / Re: Glass Kiln Control on: January 17, 2013, 11:04:45 pm
Bummer... Attachments no longer work...  :-(

Check back another time, seems like a server error, the file should be available once fixed.
951  Community / Exhibition / Gallery / Re: Virtual hard disk for an old school computer on: January 17, 2013, 11:01:13 pm
Nice, hehe, chuck on a wifi/ethernet shield and host the data from a webserver.
952  Using Arduino / Programming Questions / Re: Help create maxSize sketch on: January 17, 2013, 08:34:13 pm
Not sure if this will even work ( didn't upload ), but this fills every single byte free on the mega

Code:
#define nothing

template< uint64_t C, typename T >
  struct LargeStruct{
    T Data;
    LargeStruct< C - 1, T > Next;
};
template< typename T > struct LargeStruct< 0, T >{ };

typedef LargeStruct< 80, uint64_t > Container; //640 bytes

PROGMEM LargeStruct< 50, Container > l_Struct;  //32k
PROGMEM LargeStruct< 50, Container > l_Struct1;   //32k
PROGMEM LargeStruct< 50, Container > l_Struct2;   //32k
PROGMEM LargeStruct< 50, Container > l_Struct3;   //32k
PROGMEM LargeStruct< 50, Container > l_Struct4;   //32k
PROGMEM LargeStruct< 50, Container > l_Struct5;  //32k
PROGMEM LargeStruct< 50, Container > l_Struct6;   //32k
PROGMEM LargeStruct< 50, Container > l_Struct7;   //32k

PROGMEM LargeStruct< 431, uint16_t > l_Struct8; //862 bytes
void setup()
  {
    volatile int i = ( int ) &l_Struct;
    volatile int i1 = ( int ) &l_Struct1;
    volatile int i2 = ( int ) &l_Struct2;
    volatile int i3 = ( int ) &l_Struct3;
    volatile int i4 = ( int ) &l_Struct4;
    volatile int i5 = ( int ) &l_Struct5;
    volatile int i6 = ( int ) &l_Struct6;
    volatile int i7 = ( int ) &l_Struct7;    
    volatile int i8 = ( int ) &l_Struct8;  
  }

void loop(){}
Binary sketch size: 258,048 bytes (of a 258,048 byte maximum)
953  Using Arduino / Programming Questions / Re: Help create maxSize sketch on: January 17, 2013, 08:23:36 pm
I have whipped up a quick sketch I'll let you play with,

at the moment, it creates a 30k progmem block.

Code:
#define nothing

template< uint64_t C, typename T >
  struct LargeStruct{
    T Data;
    LargeStruct< C - 1, T > Next;
};
template< typename T > struct LargeStruct< 0, T >{ };

typedef LargeStruct< 150, uint32_t > Container; //600 bytes

PROGMEM LargeStruct< 50, Container > l_Struct; //Fills to 30k bytes


void setup()
  {
    volatile int i = ( int ) &l_Struct;
  }

void loop()
  {
   
  }
Binary sketch size: 30,748 bytes (of a 258,048 byte maximum)
954  Community / Exhibition / Gallery / Re: Wall-E's Friend on: January 17, 2013, 06:01:15 am
Looks like a lot of work, great job.
955  Using Arduino / Programming Questions / Re: Program hangs in the middle of execution on: January 17, 2013, 05:58:20 am
Rather than posting a list of things that could possibly cause that. You should just post your code, it'll narrow it down significantly.
956  Using Arduino / Programming Questions / Re: possible compiler malfunction on: January 16, 2013, 09:38:39 am
nah, the forums are having a silly moment, I keep getting 503 errors when I try download.
957  Using Arduino / Programming Questions / Re: possible compiler malfunction on: January 16, 2013, 09:28:50 am
The IDE adds '#include "Arduino.h" before the first line of code, pre-processor directives ( #ifndef, #define ) are not considered.
So the IDE takes what it thinks is the first line of code, which is 'gt4ghuitregbuitregbre'

adding a dummy integer declaration above may fix it too, separating into multiple files is another option. Either way, the stuff protected by pre-processor commands cannot be the first thing in the sketch.

958  Using Arduino / Programming Questions / Re: possible compiler malfunction on: January 16, 2013, 09:05:51 am
dhenry: im not at my computer right now (im at school) but i know that 92 bytes is very tight. i am not sure exactly how i will implememnt this until i do physical testing, but 92 bytes is a worst case scenario. even so, i can store multiple values in one byte by using bitshift operators if the values are small enough.
pYro: how would #Including <SPI.h> help? i am not using any SPI anything

The working output is still wrong ( the ide adds #include "Arduino.h" inside the #ifndef ), the spi.h adds in the arduino header, which other libraries will do. This whole mess is why I encourage you to stick your defines in a header to avoid it being messed with.
959  Using Arduino / Programming Questions / Re: possible compiler malfunction on: January 16, 2013, 08:30:16 am
This:
Code:
#define DISABLE_CAMERA
#ifndef DISABLE_CAMERA
  gt4ghuitregbuitregbre
#endif

void setup()  { return; }
void loop() {return;}  

produces this ( does not compile ):
Code:
#line 1 "_01_Initialisation.ino"

#define DISABLE_CAMERA
#ifndef DISABLE_CAMERA
  #include "Arduino.h"
gt4ghuitregbuitregbre
 

void setup();
void loop();
#line 4
gt4ghuitregbuitregbre
#endif

void setup()  { return; }
void loop() {return;}  

When I add an include on top, it compiled fine:

Code:
#include <SPI.h>

#define DISABLE_CAMERA
#ifndef DISABLE_CAMERA
  gt4ghuitregbuitregbre
#endif

void setup()  { return; }
void loop() {return;}

It is just a result of the IDE, add your defines to a header file instead, might fix things.
960  Using Arduino / Programming Questions / Re: Need help to clean up codes on: January 15, 2013, 09:03:05 pm
These links may be helpful.
http://www.cplusplus.com/doc/tutorial/
http://www.cplusplus.com/doc/tutorial/control/ -> Read iteration structures ( loops )
http://www.cplusplus.com/doc/tutorial/arrays/

You can make good use of arrays and loops, especially for the alarmRepeat function calls.


Pages: 1 ... 62 63 [64] 65 66 ... 122