STAR Firmware by JonnyC - Source Code and Explanation

thank you

Yeah, if you don't set the compiler to -Os it comes out way too large.

even set to -os it is still too large. it was 777bytes (base 16) and now its 752 bytes (base 16) which is still 1.8k.

ill start over and build with -os on rather than just rebuilding the existing project.

Brian

Huh. Did you add a lot of stuff to it? It should build just fine, even with a few extra modes added in. This is what it should look like:

yup those are my settings. 1.83kb file size

i added nothing. pasted it into the editor, changed the settings, saved (to make sure the settings would take effect and then built.

Brian

Hmmm. Are you sure you're selecting the AVR/GNU C Compiler and not the AVR/GNU C Linker? Did you delete the initial information that is in the file when you start a new project?

yes and yes

Not sure what's going on then, it should work. Did you create a C executable project for the ATTiny13A? I've never had a compile issue with these settings and I'm also using 5.1.

yes and yes……:slight_smile:

I also can’t get the unedited star firmware to compile under Atmel Studio (V6.1). This is also with the optimization level set for -Os. Is there some other setting somewhere that we are missing?

Error 1 Program Memory Usage : 1036 bytes 101.2 % Full (Memory Overflow)
Data Memory Usage : 50 bytes 78.1 % Full star 0 0 star

I know that some people have had issues with 6.1 not working size wise. The optimization routine must have changed.

i just tried toms revision of the code. it comes out at 1.73k

Gotta be something on your end then, but I don't know what it is. I would try downloading version 5.0 and try again.

ok. is 5.0 from atmel working unlike 5.1?

I was wrong in my earlier post, I am running 5.0. Thought I was using 5.1. I am running this version on Windows 7 x64, downloaded from Atmel: 5.0.1163.

ok ill try it

Yeah… for some reason I had the same issues with compiling on 6.1, used comfychairs “howto: Use Atmel AVR Studio 5.1 to make a .hex file” and now they all compile like a champ!

I had to download the version from his link though…not sure why it doesn’t work on 6.1 but works fine on 5.1

I have a shared repository of the STAR firmware and a few custom builds as well

https://www.dropbox.com/sh/to5amc0pnli7w5y/kLRnE7ZmN4

Sorry took so long. File size is very deceiving. A .HEX file is Intel HEX format, which is an ASCII format to represent binary data. It's about 3 times the size of the binary data. Not sure you are aware. My version is compile, running in a light easily, using Studio 6.2 (latest, BETA version).

If you open up the .hex file in an editor (NotePad++ for example), it has 43 chars per line, which is one record. For example:

:1002500094E00197F1F700C0000009DFE8CFF894BF 

The record is as follows, with all field in hex notation (also known as HEX-ASCII):

  • ":10" header - record size, this means 16 bytes in this record (3 chars)
  • "0250" address field (4 chars)
  • "00" think this is a record type (2 bytes)
  • "..." 16 bytes of binary data (32 chars)
  • "BF" record checksum (2 bytes)

The entire hex file:

:100000000CC024C033C022C021C020C01FC01EC0ED
:100010005AC01CC000050F5CFF0011241FBECFE9B1
:10002000CDBF10E0A0E6B0E0E2E6F2E002C005904D
:100030000D92A236B107D9F720E0A2E6B0E001C0E8
:100040001D92A736B207E1F7DBD009C1D9CF96B32D
:1000500093FB992790F981E0982780916300880F9E
:10006000892B809363008F7090E008951895F89421
:10007000A89584B7877F84BF81B5886181BD11BC95
:10008000789410926500E3DF892B39F08FEF9AE4C2
:100090000197F1F700C00000F6CF8BB780628BBFED
:1000A00085B7806285BF889585B78F7D85BF8BB703
:1000B0008F7D8BBFF894A89581B5886181BD80E460
:1000C00081BD789408951F920F920FB60F9211245C
:1000D0002F933F934F935F936F937F938F939F9350
:1000E000AF93BF93EF93FF93B2DF892BF1F0809131
:1000F00065008F3F29F0809165008F5F80936500D8
:1001000080916500803169F480916600811102C0A0
:1001100084E003C080916600815080936600109255
:1001200064008CEB809360005AC0809165009091D0
:1001300064008823A1F080916500803180F4809173
:1001400066008F5F80936600853010F01092660025
:100150009B3410F010926600109264003EC081E063
:10016000890F09F48FEF80936400809160008823E9
:1001700019F08150809360008091600081112DC042
:10018000349B16C025B130E080916600813019F4AF
:1001900085E790E002C082E890E02817390734F440
:1001A000809162008F5F8093620002C010926200B3
:1001B00080916200843080F080916600811102C0DD
:1001C00084E003C0809166008150809366001092A5
:1001D00062008CEB80936000369A10926500FF916C
:1001E000EF91BF91AF919F918F917F916F915F91AF
:1001F0004F913F912F910F900FBE0F901F90189528
:1002000017BA89E188BB88E085BB82E087BB81E2C1
:100210008FBD81E083BF81E687B9A29A86EC86B95B
:10022000479A85B7877E806185BF21DFC0E08091D6
:1002300066008C17E1F3C0916600E0916600F0E083
:10024000EC5EFF4FE491E9BD89B58111F0CF8FEAF3
:1002500094E00197F1F700C0000009DFE8CFF894BF
:02026000FFCFCE
:02026200BC00DE
:00000001FF

For the amount of real memory it will take, look at the second to last record: address of 262 hex for length of 2 bytes, therefore total file size:

264H, which is 612 bytes

So, plenty of space left over, because 1,024 bytes is available for program space. This match's what shows in the .map file exactly.

Under 6.2 BETA, the created binary was 4 bytes smaller than under 6.1 I believe.