Show Posts
Pages: 1 2 [3] 4 5 ... 462
31  Development / Other Software Development / Re: Code size with different versions and -flto optimization on: September 01, 2014, 06:52:12 pm
Quote
That is something for the Arduino Mega 2560.
I'm not very fond of the 2560 boards; the chip itself is overpriced for its capabilities.
There are the 3rd party 1284-based boards, and the ARM boards to consider...
32  Using Arduino / Microcontrollers / Re: Atmega2560 bootloader hex file? on: September 01, 2014, 04:36:13 am
Mark's message is from several years ago.  The "!!!" fix has been in the bootloader sourcecode that's distributed with the Arduino IDE (hardware/arduino/avr/bootloaders/stk500v2/stk500boot/*)  I think the .hex file there is recent as well.

Unfortunately, I don't think that "they" have updated the version that is loaded into the actual MEGA boards.
33  Development / Other Software Development / Re: Code size with different versions and -flto optimization on: September 01, 2014, 03:41:50 am
Quote
What kind of indication can I get from those??
You should compare against output from the same command for the older compiler.
If each function has gotten a little bigger, you can say that the compiler is worse.
If the new version is including functions that you believe are not called, you can blame LTO and/or garbage collection (which I gather works slightly differently in the new compiler.)
If SOME functions have gotten significantly bigger, it could be new library versions that support new features.
Etc...

I've spent a lot of time doing such exercises.  Frankly, if your original program is 5% below the maximum, and  your new code is 10% over, you're pretty much screwed.  You can face a never-ending battle to keep your code below the limit, but you end up having to remove a feature every time you want to add one, and you would probably be better off looking for a new and bigger processor instead.  In your case, with the code size increasing 25% with no source change, I think it is worth further investigation.
34  Development / Other Software Development / Re: Code size with different versions and -flto optimization on: September 01, 2014, 01:01:22 am
well, analyze...
Try " avr-nm -S --demangle --size-sort *.elf" in your build directory:

avr-nm -S--demangle --size-sort *.elf
    :
0080012e 00000044 B rx_buffer
00800172 00000044 B tx_buffer
0000093e 00000048 T print_binary(unsigned char)
00001838 00000052 T HardwareSerial::read()
000019f4 00000054 T Print::write(unsigned char const*, unsigned int)
000015b6 00000076 T __vector_18
00001652 00000076 T __vector_19
0000153e 00000076 T init
000018aa 00000080 T HardwareSerial::write(unsigned char)
00001c38 00000080 T Print::print(long, int)
000013fc 00000090 T __vector_16
00000cb6 0000009a T print_fuse_extended()
0000192a 000000ac t global constructors keyed to rx_buffer
0000148c 000000b2 T delay
000009a6 000000b8 T print_boot_analysis()
00001ad0 000000c8 T Print::printNumber(unsigned long, unsigned char)
00000bae 00000108 T print_lock_bits()
000016c8 0000010e T HardwareSerial::begin(unsigned long)
00001014 0000013a T print_serno()
00000a5e 00000150 T print_signature()
00000d50 0000015a T print_fuse_high()
00000eaa 0000016a T print_fuse_low()
0000114e 0000028e T loop
35  Using Arduino / Programming Questions / Re: Calculating Percentages yields 0% or 100%- never between on: August 31, 2014, 10:19:36 pm
Quote
Code:
fanRPM_percentage= (fanRPM / maxfanRPM) * 100;
That's because all your variables are integers, and integer division is truncated for results less than a whole number.
So 99/100 == 0.  100/100 = 1.

If you use a bit of algebra (even though no one ever uses algebra past their school years; they should just stop teaching it. :-; ), and rearrange your equation like so, you should get much more satisfactory results (without the expense of using floating point, BTW.  fanRPM_percentage doesn't need to be float, either.):
Code:
fanRPM_percentage= (fanRPM*100) / maxfanRPM;

36  Using Arduino / Programming Questions / Re: After set a watchdog,the mcu died.I can't reset it though the Reset pin on: August 31, 2014, 08:53:36 pm
With the current bootloader, it will be impossible to tell the difference between EXTRF and WDTRF.
37  Using Arduino / Programming Questions / Re: Blink without delay - Generating a periodic function with a simpler way on: August 31, 2014, 05:54:49 pm
Something like this, perhaps?

Code:
void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}

boolean delay_without_delaying(unsigned long time) {
  // return false if we're still "delaying", true if time ms has passed.
  // this should look a lot like "blink without delay"
  static unsigned long previousmillis = 0;
  unsigned long currentmillis = millis();
  if (currentmillis - previousmillis >= time) {
    previousmillis = currentmillis;
    return true;
  }
  return false;
}

boolean delay_without_delaying(unsigned long &since, unsigned long time) {
  // return false if we're still "delaying", true if time ms has passed.
  // this should look a lot like "blink without delay"
  unsigned long currentmillis = millis();
  if (currentmillis - since >= time) {
    since = currentmillis;
    return true;
  }
  return false;
}

unsigned long ledtime = 0;
unsigned long atime, btime, ctime, nltime;

void loop() {
  static int ledstate = false;
  if (delay_without_delaying(ledtime, 500)) {
    ledstate = !ledstate;
    digitalWrite(13, ledstate);
  }
  if (delay_without_delaying(atime, 100)) {
    Serial.print("A");
  }
  if (delay_without_delaying(btime, 200)) {
    Serial.print("B");
  }
  if (delay_without_delaying(ctime, 30)) {
    Serial.print("C");
  }
  if (delay_without_delaying(nltime, 1000)) {
    Serial.print("\n");
  }
}
38  Using Arduino / Programming Questions / Re: After set a watchdog,the mcu died.I can't reset it though the Reset pin on: August 31, 2014, 03:32:22 am
(The latest optiboot does save MCUSR, and passes it to the sketch in R2.  So the code that runs before other stuff that saves R2 in a variable IS what should be there.)
What values were you expecting to see?  "8" is reset by the watchdog, which is what you'll normally see for an external reset or actual Watchdog timeout (The "external reset" EXTRF (2) reason will actually run the bootloader, and the bootloader then runs the sketch by triggering a WD reset.)  You should see PORF (1) on poweron, and BORF on brownout (hopefully never!)
39  Development / Suggestions for the Arduino Project / Re: Arduino MEGA2560: 8K of bootspace, only 4K of flash reserverd on: August 30, 2014, 02:56:56 am
Seems wrong to me.  The 1280 max sketch size is similarly incorrect...
40  Using Arduino / Programming Questions / Re: After set a watchdog,the mcu died.I can't reset it though the Reset pin on: August 30, 2014, 02:51:03 am
Quote
I have to use 8Mhz bootloader.And I need MCUSR,too.I can't use optiboot because they use 115200bps which is too fast.
Take the default (16MHz) optiboot bootloader and put it on your 8MHz chips.  Then configure your boards.txt so that the upload speed is 57600 instead of 115200 (half the clockrate means half the upload speed.)
41  Development / Other Hardware Development / Re: A Shield for enabling graphical interfaces via your smartphone on: August 29, 2014, 02:37:34 am
Since a lot of "displays" that people are using now (phones, tablets, desktops) are much more "powerful" than the microcontrollers people are trying to connect to them, I'm wondering if anyone has been thinking about defining a new "smart terminal" protocol that would move processing and memory requirements AWAY from the microcontroller.  graphics is swell, but an Arduino doesn't have the memory.  I'd rather tell the display "here's a sprite that's moving at such a speed/acceleration; let me know if and where it collides with a user's finger on the touchscreen."
42  Development / Suggestions for the Arduino Project / Re: Non blocking hardware serial on: August 28, 2014, 02:53:42 pm
I created https://github.com/arduino/Arduino/issues/2271
43  Using Arduino / Programming Questions / Re: Using the Z register in assembler on: August 28, 2014, 02:44:48 pm
Quote
   "ld r0, Z \n\t"
    "mov %0, r0 \n\t"
with "ld", You're reading RAM.  You need to use "lpm" to read from the flash.
(RAM at 7FFE doesn't exist; who knows what you'll get)
(also note that the normal Uno Fuse settings do no allow lpm in the application to read from the "boot section")
44  Community / Bar Sport / Re: How many times is someone not replying after asking question ? on: August 28, 2014, 02:39:47 pm
dude, if you don't do my homework for me by the time it is due, an answer is of no use!
45  Community / Bar Sport / Re: Gas carrying charged particles on: August 28, 2014, 02:15:05 pm
A charged thing stores some energy even in the absence of a second conductor, andthere's an equation for the capacitance of an isolated conductive sphere: Proportional to the radius...  (4*pi*epsilon*R)
Pages: 1 2 [3] 4 5 ... 462