2.4 KB code "loads" into tiny25 !?

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm working with company related code, and the overall circuit/program is used for capacitive sensor reference work ( so can't post the code ). The code was written using Arduino 1.8.1 and is now ~2.4 KB, and someone didn't change the BOM part to be a tiny 85 instead of t25 when this batch of boards was built. Originally it was for a t25, but the developer's code grew, a bit, beyond the flash of a t25. T85s have been ordered and our Proto Dept can R/R these boards, but in the meantime the person who is loading the code to the MCUs, states that the t25s program successfully ( she has to select t85 in the IDE, though ) !? I then took a couple of these boards, and looked at the t25's PWM output ( corresponds to a capacitive sensor's value ) on a scope and it looks good...

 

So...the design is working as best as I can tell. 

 

1)  How is it possible that larger code than the MCU's flash capacity can be loaded to it ? 

2) Does anyone know if issues can/will develop over time with the MCU, for this situation ? 

 

We only need < 200 units and this board is for internal use only, and I don't know if we can just go this the boards as they are or what the risks could be. I had already been working on a C- version before this issue was found last week, and it comes out to 990 bytes, and has a bit more functionality in it for MCU temp calibration and some EEPROM R/Ws, but I'm working out a bug.

 

 

S/W: Arduino ver 1.8.1

Programmer: Pocket Programmer ( Sparkfun ), so it's usbtiny_isp

 

 

Jerome  

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

indianajones11 wrote:

...and is now ~2.4 KB,  

 

How do you know it is 2.5KB?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you verify that all of the code is actually in the micro?  As a general statement, some code code be missing & a product could appear to work fine, until that missing code is needed.  One day, you push the spin cycle button instead of ultraclean & all of the water valves suddenly come on nonstop & flood your stamp collecting room.   But I swear, it was working fine for 3 months

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did it pass verification after programming? I would think whatever was at the end of the code would be truncated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

indianajones11 wrote:

...and is now ~2.4 KB,  

 

How do you know it is 2.5KB?

As reported by Arduino after compiling.

 

@avrcandies

Yeah, that's what I'm afraid of ( Even though it is only for internal use ). For the PWM to be outputting, as it is doing, that tells me the setup() is in there ( for the MCU's PWM and the cap_sense chip, using TinyWire-TWI for comms between them ). The loop() checks capacitance status register and MCU reads the value if status bit is '1'. There is a 2-branch if and then the PWM output. It all seems to be in there ( flash ).

 

@ Kuch

IDK if they applied that setting in their IDE, but I had the same thought about truncating the end of the code. 

 

Well, I just now had time to try programming it on my setup with a t25, and when I set the IDE to t85 ( this is what she said she did to get it to program ), and check the "verify" option in Preferences, I get and error that it's the wrong MCU. makes sense.

 

Then I set MCU to tiny25 and now the error shows, "sketch too big". Also makes sense ! She's gone for the day and I'm about to leave myself. Will update thread Tuesday ( I'll have to see exactly how she's 'accomplishing" this feat ).

 

 

 

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

indianajones11 wrote:
I'll have to see exactly how she's 'accomplishing" this feat

 

If you put the .elf in a ZIP file the code will compress by 20%, and tell the programmer its a T85, hence the program fits. devil

 

 

 

Seriously though, what is the size of the .elf file?  It does indeed sound like she's found some gold at the end of the rainbow.  Unless she's disabling a bootloader fuse maybe thus squeaking out a few extra bytes?

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The critical test is verification.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I build code in Arduino IDE it says things like:

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

So exactly how many bytes and what % does it report for your build? Also what does it say the "Maximum" is ?