ezieragabriel / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Serial port no longer shows up when trying to print from a specific integer array #1042

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile and upload the attached code.
2. Notice that /dev/tty.usbmodemfa131 still exists.
3. Uncomment line 258, recompile, and upload.
4. Notice that /dev/tty.usbmodemfa131 has disappeared. Also, the board must now 
be restarted for upload to succeed.

What is the expected output? What do you see instead?

Printing from the array should not change the serial port, yet it does.

What version of the Arduino software are you using? 1.0.1
On what operating system?  Mac OS 10.6.8
Which Arduino board are you using? Leonardo R3, tested on two separate 
Leonardos purchased in the same order.

Original issue reported on code.google.com by alex.n.j...@gmail.com on 12 Sep 2012 at 2:56

Attachments:

GoogleCodeExporter commented 9 years ago
With line 258 uncommented, I see RAM consumption of over 4k byte.  Leonardo 
only has 2.5k of RAM.  (With line 258 commented, there are no other uses of 
dt2[] in the sketch, so it is optimized into non-existence, freeing a big chunk 
of ram.)

avr-size 
/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build1647521302299277532.tmp/sk
etch_sep12a.cpp.elf
   text    data     bss     dec     hex filename
   5672    2046     216    7934    1efe /var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build1647521302299277532.tmp/sketch_sep12a.cpp.elf
BillW-MacOSX-2<10392> avr-size 
/var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build1647521302299277532.tmp/sk
etch_sep12a.cpp.elf
   text    data     bss     dec     hex filename
   5736    3912     216    9864    2688 /var/folders/jz/5yb8f2hr8xjcpf0059bsfz4r0000gn/T/build1647521302299277532.tmp/sketch_sep12a.cpp.elf

If dt and dt2 are constants, investigate putting them in flash memory (see 
"pgmspace")
(not an Arduino-level issue, except as another example of needed some RAM 
sizing info.)

Original comment by wes...@gmail.com on 12 Sep 2012 at 4:37

GoogleCodeExporter commented 9 years ago
I'm not sure how to see the RAM consumption still, but I'll look into it and 
check about flash memory as well.

The only indicator I saw of memory use at the end of a verify was:
 'Binary sketch size: 11,996 bytes (of a 28,672 byte maximum)'
but maybe this is only a flash memory check?

It could be helpful to add a RAM use check as well for the configured board and 
print that message below the binary sketch size.

Thanks

Original comment by alex.n.j...@gmail.com on 12 Sep 2012 at 5:32

GoogleCodeExporter commented 9 years ago
The RAM size check is http://code.google.com/p/arduino/issues/detail?id=40&q=RAM
(also issue 444)
It's a bit thorny because of the complications that happen when ram is "nearly" 
full.  No existing compile-time RAM checks include RAM space used by the stack 
or dynamic allocation, so even if avr-size reports large amounts free, you 
could still run out.  I think the team is worried that providing a false sense 
of security is worse than providing no info at all.

Original comment by wes...@gmail.com on 13 Sep 2012 at 12:03