Show Posts
Pages: 1 2 3 [4] 5 6 ... 463
46  Using Arduino / Microcontrollers / Re: How to create new optiboot hex file for ATmega328p using Atmel Studio on: September 03, 2014, 07:04:37 pm
Quote
I'm guessing that I don't [have the link options set up].  How do I go about doing that?
Beats me.  I find the way that AS spreads out options and actions across dozens of buttons, menus, and panels, to be close to incomprehensible.   I'm a CLI dinosaur - at least if I have to go searching through man pages, I can actually search...
And while AS may have tutorials and features to aid the beginning developer, aiding the importation of legacy-tool-based code doesn't seem to be very high on the priority list.

Try this:
  Use the "Project Properties" menu to open up the project properties panel.
  Select the "Toolchain" sub-panel.
    Select the "General" sub-option under the AVR/GNU Linker option.
      check the -nostartfiles checkbox
      check the -nodefaultlibs checkbox
      check the -nostdlib checkbox
   Select the "Optimization" sub-option
     un-check the "gc-section" checkbox
  Select the "Memory Settings" sub-option
   click on "add-item" box next to "FLASH sgement"
     add ".text=0x7e00"
   click on "add-item" box next to "FLASH sgement"
     add ".version=0x7ffe"

Or it might be easier to do the "Use external Makefile" option under "Build"; but a lot of the Makefile options are not really compatible with the way that AS thinks of a "project"  ("one project builds for multiple different devices?  The horror!")


I'll do a little more experimenting to see if I can import the files to an AS project and actually get it to compile...
47  Using Arduino / Microcontrollers / Re: Using the AVR JTAGICE3 programmer with Arduino IDE on: September 02, 2014, 10:02:12 pm
JTAGICE3 will do ISP uploads as well as JTAG.  I'm pretty sure that recent versions of avrdude will support JTAGICE3, so it's just a matter of configuration/etc.  You can probably do it by changing arduino/programmers.txt
48  Using Arduino / Microcontrollers / Re: How to create new optiboot hex file for ATmega328p using Atmel Studio on: September 02, 2014, 09:53:56 pm
Do you have the link options set up to properly locate the bootloader at the end of FLASH?
49  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...
50  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.
51  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.
52  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
53  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;

54  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.
55  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");
  }
}
56  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!)
57  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...
58  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.)
59  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."
60  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
Pages: 1 2 3 [4] 5 6 ... 463