Show Posts
Pages: 1 2 [3] 4 5 ... 122
31  Development / Suggestions for the Arduino Project / Re: Need mechanism to pass defines to library cpp files on: April 16, 2014, 03:24:53 pm
Where is the source with the floating point functions in. I tried this one http://forum.arduino.cc/index.php?topic=227351.0 but  you must have a newer version.

EDIT: found the 0.72 version, no luck there either.
32  Using Arduino / Programming Questions / Re: Upload bigger than 28.800bytes does't complete? on: April 15, 2014, 08:50:27 pm
Pretty much all my clone Mega 2560's had this problem. Replacing the bootloader was the fix.

With regards to the bootloader, I'm not sure what the original one was, it just didn't work. Never had the problem on an Uno though ( rare for such a large sketch ). Either way replacing the bootloader can't hurt.
33  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 08:24:02 pm
Zipping it up would be good. I would like to recreate the error to have a look.
34  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 12:44:10 pm
It appears that internal interrupts require extra help, but interrupts using attachInterrpt should be straight forward.

Code:
extern "C"{
  __attribute__ ((section (".text"))) void __vector_9();
}

void setup(){
}

void loop(){
}

ISR(PCINT0_vect){    //This is __vector_9
  return;
}
35  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 12:29:02 pm
That sketch was just an example, you do not need anything from it.

For the ISR that is having problems, create a prototype for it and add __attribute__ ((section (".text"))).

The function can be where ever you like, and you need to manually add the prototype to add the attribute to as it cannot go on the definition.
36  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 12:08:37 pm
I do not think an ISR can be put into the init sections, the .initn sections are run like one big function init0-init9 and aren't callable.
You could use v1.5.5 of the IDE and specify a custom location in the command line by editing platform.txt.

However, maybe some good news.

Using the code above I added a .text section to loop() and it moved to the first item.
Code:
__attribute__ ((section (".text"))) void loop();

Without .text
Quote
0000020c 000000a0 t do_random
000002a0 00000006 T random_r
000002a2 0000000a T random
000002a8 00000012 T srandom
000002ba 00000090 T __vector_23
0000034a 00000026 T loop
0000036a 00000012 T main

With .text
Quote
0000020c 00000026 T loop
0000022c 000000a0 t do_random
000002c0 00000006 T random_r
000002c2 0000000a T random
000002c8 00000012 T srandom
000002da 00000090 T __vector_23
0000036a 00000012 T main

Maybe try it on the offending ISR.
37  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 11:40:19 am
I just had a go myself,
here is a sketch that replicates the Arduino setup, just smaller ( compiled size ).

init is run before setup, just like Arduinos default.

I could have used .init3 for init, however setup must be after .init6 so global libraries can construct. Including wiring.c is just a hack to avoid copying some code.

Code:
int main() __attribute__ ((naked));
__attribute__ ((naked)) __attribute__ ((section (".init7"))) void init();
#include "wiring.c"
__attribute__ ((naked)) __attribute__ ((section (".init8")))  void setup();

int main(){

  #if defined(USBCON)
  USBDevice.attach();
  #endif
 
  while( true ){
    loop();
    if (serialEventRun) serialEventRun();
  }
  return 0;
}

void setup(){

}

void loop(){

}
38  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 10:50:12 am
BTW is it possible to assign data to an area of memory as pYro_65 suggested in the arduino IDE?

Yes, http://www.nongnu.org/avr-libc/user-manual/mem_sections.html
39  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 01:10:35 am
Delete the temp compile folder, If I compile for Due then switch to an AVR, the SAM files can sometimes cause errors.

Is this the interrupt: Timer/Counter2 Compare Match B

Can you post the interrupt function.
40  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 01:03:27 am
Quote
Would it make a difference if I didn't use attachInterrupt() and instead set the registers myself

I do not think so, the linker decides where everything goes, which happens after the code is compiled. This is only a guess, give it  a try.

41  Using Arduino / Programming Questions / Re: Strange error message on: April 15, 2014, 12:40:16 am
Putting the data in far progmem could solve it. The data at the moment is probably sitting between the interrupt vector table and the actual ISR. As the data size is greater than 4Kb, the RJMP, and RCALL instructions fail.

When the data is moved into far memory, the linker could take the opportunity and move the ISR closer, within range.

There are many memory sections available for use, you could possibly declare your ISR to be inside a closer section.
If all else fails, you can use AVR studio /manually edit command lines and specify the locations you want your data sections, even create new ones. A section could be created at the end of near memory for your data, avoiding the far memory overhead, and remaining compatible with current near progmem helper functions.
42  Using Arduino / Programming Questions / Re: Using the .net framework with the arduino on: April 15, 2014, 12:28:13 am
You can write a windows program using .NET to interact with the Arduino. If you want to use the .NET framework on a microcontroller, you should have a look at the .netduino, it is programmed in C#.
43  Using Arduino / Programming Questions / Re: Strange error message on: April 14, 2014, 11:43:46 pm
With a smaller sketch it can still occur.

I did a quick search and someone has posted a nice answer:
The AVR devices support two kinds of jump/call instructions: JMP vs. RJMP, and CALL vs. RCALL. The R variants make calls relative to the current location and are more efficient both in usage of program memory and execution time. This comes at a cost though: RJMP and RCALL can only be used for addresses in the range of +/-4kb from their location in program memory. This is never a problem on devices with no more than 8kb of program memory because the whole 8kb range can be addressed from any location via RCALL or RJMP.

On devices with more than 8kb of program memory, however, this is not true for all possible locations. Therefore, if the linker decides it can put the code to be called within the +/-4kb range from the RJMP/RCALL there will be no problem, but if the linker fails to (re-)locate the code to be within that range, RJMP/RCALL cannot be used to reach the code's new address, the address is thus truncated (just like when doing uint16_t value = 12345; uint8_t truncatedValue = value; in C) and the generated code breaks.

The ISR is called from the vector table using the relative versions.
44  Development / Other Software Development / Re: Save data to file on: April 14, 2014, 11:05:12 pm
HTerm is the best, it has the connect + save data buttons right next to each other. All the main functionality you'd expect is on the main screen.  Nothing to install either, it is one file.

Their homepage below has the download link at the top, it is in german, but the application is in English.
http://www.der-hammer.info/terminal/
 
45  Using Arduino / Programming Questions / Re: Strange error message on: April 14, 2014, 10:15:36 pm
Is your code over or close to 64K, I'll assume it is.

Quote
(.vectors+0x3c): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_15' defined in .text section

Your PROGMEM data ( or simply a large sketch ), like whats defined in Arial_Bold_14.h is pushing some ISR vectors into far memory.

AVR pointers are 16 bits, far memory requires 18 bits to address fully. You can only read half the Mega using conventional pointers.

Your vector is placed in far memory, thus given a 32 bit pointer, however vectors only support 16 bit pointer addresses causing the truncation. The result is, the ISR cannot be reached.

I recently helped someone out with a similar problem, a way to locate the PROGMEM data in far memory instead of the vector can be found here: http://forum.arduino.cc/index.php?topic=232724.msg1680144#msg1680144
Pages: 1 2 [3] 4 5 ... 122