STAR Firmware by JonnyC - Source Code and Explanation

Hey smart people I’m having an issue I can’t get rid of- first I thought it was limited to my E12 with a tiny10 running a baby FET but I’m now getting it on my TC300 with a BLF17DD v2 running with a zener mod and MT-G2…

When the light is off (I’ve changed the default to no memory without soldering the star) it will come on in moonlight PWM =1, true “moonlight mode” (also set in the programming to default on without soldering star, not just low set to 1)and at initial start up it works fine but when cycling up threw the modes when it rolls around back to moonlight there is an extremely bright flash after turbo. Like I said at first I was thinking it had to do with the baby FET I have on the tiny10 but now it’s doing it on a 17dd that started with completely different code, not just a rewrite.

Other variables to mention are 1 WDT tick before mode is memorized, on-time and fast PWM.

priest77 - dunno, haven't dlnd'd and tried that source code. Did this come from JC or RMM? Maybe they know? Wonder if the Dev Studio versions are the same - what you use and they used, or something like optimization settings for the build. If you used same source with nothing edited, then could be the tools you are using are generating compiled code that's not as efficient or optimized as they did.

I use Atmel Studio 6.0, or newer.

@priest77
afaik different compiler might produce different hex file sizes while compiling the same source code.
0x0410 means your hex file is larger than 1024 byte which is max for Attiny13a, as Tom E wrote.
Atmel Studio shows the size in the bottom window (scrolling up a bit) after compiling, so you can see if it is too large before flashing.
You might try reducing the code slightly by removing unneeded features, as you are only slightly above 1kB.

You are both right. I’ve installed latest version Atmel Studio 6.2 and now it tells me this:

Now I am not sure what code part can be removed.
I want to remove the feature of “Star 3 = H-L if connected”

I run Atmel Studio 6.2, just downloaded STARStrobe1.0.c, created a new solution and project (actually just copied and renamed an existing one), build output below. The key info is these two lines:

Program Memory Usage : 1012 bytes 98.8 % Full

Data Memory Usage : 50 bytes 78.1 % Full

It's big but just fits. I'd carefully check the compiler and linker arguments. It says below it's using vers 4.8.1. Also, you must use the "Optimize for size" setting of -Os.

------ Rebuild All started: Project: STARStrobe, Configuration: Release AVR ------

Build started.

Project "STARStrobe.cproj" (Clean target(s)):

Target "Clean" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Compiler.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (entry point):

Using "RunCompilerTask" task from assembly "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils

C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils\make.exe clean

rm -rf STARSTROBE.o

rm -rf STARSTROBE.d

rm -rf "STARStrobe.elf" "STARStrobe.a" "STARStrobe.hex" "STARStrobe.lss" "STARStrobe.eep" "STARStrobe.map" "STARStrobe.srec" "STARStrobe.usersignatures"

Done executing task "RunCompilerTask".

Done building target "Clean" in project "STARStrobe.cproj".

Done building project "STARStrobe.cproj".

Build succeeded.

------ Rebuild All started: Project: STARStrobe, Configuration: Release AVR ------

Build started.

Project "STARStrobe.cproj" (default targets):

Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').

Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Compiler.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (target "Build" depends on it):

Task "RunCompilerTask"

Shell Utils Path C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils

C:\Program Files (x86)\Atmel\Atmel Studio 6.2\shellUtils\make.exe all

Building file: .././STARSTROBE.c

Invoking: AVR/GNU C Compiler : 4.8.1

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-gcc.exe" -x c -funsigned-char -funsigned-bitfields -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=attiny13a -c -std=gnu99 -MD -MP -MF "STARSTROBE.d" -MT"STARSTROBE.d" -MT"STARSTROBE.o" -o "STARSTROBE.o" ".././STARSTROBE.c"

Finished building: .././STARSTROBE.c

Building target: STARStrobe.elf

Invoking: AVR/GNU Linker : 4.8.1

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-gcc.exe" -o STARStrobe.elf STARSTROBE.o -Wl,-Map="STARStrobe.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mmcu=attiny13a

Finished building target: STARStrobe.elf

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "STARStrobe.elf" "STARStrobe.hex"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "STARStrobe.elf" "STARStrobe.eep" || exit 0

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "STARStrobe.elf" > "STARStrobe.lss"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "STARStrobe.elf" "STARStrobe.srec"

"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1051\avr8-gnu-toolchain\bin\avr-size.exe" "STARStrobe.elf"

text data bss dec hex filename

1012 0 50 1062 426 STARStrobe.elf

Done executing task "RunCompilerTask".

Using "RunOutputFileVerifyTask" task from assembly "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Extensions\Application\AvrGCC.dll".

Task "RunOutputFileVerifyTask"

Program Memory Usage : 1012 bytes 98.8 % Full

Data Memory Usage : 50 bytes 78.1 % Full

Done executing task "RunOutputFileVerifyTask".

Done building target "CoreBuild" in project "STARStrobe.cproj".

Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').

Target "Build" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Avr.common.targets" from project "C:\Tiny13a Projects\STARStrobe\eswitch\STARStrobe.cproj" (entry point):

Done building target "Build" in project "STARStrobe.cproj".

Done building project "STARStrobe.cproj".

Build succeeded.

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

To correct the Optimization setting to "-Os" in Atmel Studio 6.2, do the following:

  • on the menu bar, click on Project, then {project name} Properties
  • click on Toolchain on the left, then click on Optimization on the list, under AVR/GNU C Compiler
  • change Optimization Level to "Optimize for size"

Sorry for not specifying, I do have my compiler optimization set to -Os

@Tom E
It worked now!
avrdude done. Thank you. :slight_smile:

priest77 did it install correctly?

Yes, now I have STARSTROBE1.0.c on my UF-T20.
I’ve tried to add STROBE as additional mode but it seems there is no room for it, I’ve got something like 100.2 % Memory Overflow.
Then I’ve just changed the Medium mode value to 254 and put it to be the last one, and I am using it like that.

Oh…make us a video it in operation please

This is the order I have:

Here is the video:

Is there any way to make STROBE some kind hidden?

You know you can change it so moon is default on so you dont need to have the star soldered, that makes it so you dont have so unsolder it every time you want to reflash.

this is the code to set it to default moon on (you can ignore my added comments, its so I remember what I change stuff from)

#ifdef MODE_MOON
if ((PINB & (1 << STAR2_PIN))> 0) { // Stock is ==, ( > for moon default to on, soldering star will disable moon)
modes[mode_cnt] = MODE_MOON;
}

There is no way that I know to make modes not in the normal cycle but if you change to memory off you wouldnt have to cycle threw it every time.

Thanks! That was giving me headache at the beginning I was trying to flash it with the star soldered…
This is much better than soldering and unsoldering every time.

Just noticed it changed that to a smiley, if you got quote my reply you can copy it from there correctly.

Add an extra space between the > and the ) otherwise it thinks you want a smiley

I’ve done it with “quote”

How can I disable the turbo time out? Should I just comment out #define TURBO_TIMEOUT ?

Yes

Just add // in front of the line then compile the .hex

Thanks for your reply. :slight_smile: