Close
0%
0%

The 1kB Challenge

The only limit is what you can do with 1 kB of program memory

Monday, November 21, 2016 08:00 am PT - Thursday, January 5, 2017 09:00 pm PT Local time zone:
Similar projects worth following

Microprocessors didn't always have Gigabytes of memory, and Microcontrollers didn't always have hundreds of kB of flash. The Hackaday 1kB challenge is a contest where entrants must create a device which uses 1kB or less of executable program code. The contest is open to any microcontroller or microprocessor architecture. Anything from Arduino board with AtMega328's to ARM and beyond. External hardware such as leds, switches, and 74 series logic chips are allowed and encouraged - but the machine code must be less than 1kB.

Official Rules:

  • Contest entry deadline is Thursday, January 5, 2017 09:00 pm PST (+8 UTC)
  • This contest is open to any microcontroller or microprocessor architecture.
  • Projects must use 1 kB or less of code, including any initialized data tables, bootloaders, and executable code.
  • <UPDATE> Unavoidable Hardcoded bootloaders such as propeller, ESP8266, or i.mx series don't count toward the 1 kB limit. Entrants can use the bootloader code to start their processor up and get their own code executing. Once things are running though, any calls into bootloader or ROM tables count against you.
  • Entrants must show how they came to the 1 kB calculation (map files, assembler/linker output, etc)
  • Existing computer systems can be used (Example - Atari 2600) however, the size of any rom routines or data tables must be included in the 1 kB calculation.
  • Mask Rom: If you are using a chip with masked rom code, you must include the size of any ROM routines you call in your final executable size calculation. If you wanted to write a program in SPIN for the Parallax Propeller, you’d need to include the SPIN interpreter ROM, which would put you over the 1 kB limit.
  • Projects can use multiple processors as long as they are running the same 1 kB binary, or if the total size of the ROM being run is less than 1 kB. (Example - two micros running different binaries which are 512 bytes long each)
  • Projects must fill out the description, details, components, and project logs.
  • Projects must be open source. Source code, schematics, and board layouts for the project software must be either posted in the files section, or include a link to a public repository such as Github.
  • Projects must use publicly accessible toolchains. Closed source toolchains (example - IAR or Keil) can be used as long as the demo versions will compile/assemble the contest code.
  • All entries will be judged by Hackaday staff.
  • Winners will be announced on or around Monday, January 16th
  • Hackaday Staff, Employees of SupplyFrame, Judges or the family of any of the preceding are not eligible to take part in this contest. Everyone is still encouraged to build awesome stuff and show it off though.

Judging Criteria:

  • Does the entry fit within the 1 kB size constraint?
  • How novel or interesting is the entry?
  • Does the documentation explain the project?
  • Are any novel techniques (example: Self modifying code) explained?
  • How complete is the entry? Projects don’t have to be complete or working to enter, however those which are finished and working by the deadline may be judged higher.

Prizes:

Any Hackaday contest needs some awesome prizes, and this one is no different.

digicomp

mselect

bulbdial

  • Grand prize is a Digi-Comp II kit from EMSL
  • First prize is a Maker Select 3D printer V2
  • Second Prize is a Bulbdial Clock kit from EMSL
  • Third Prize is a Blinkytile kit from Blinkinlabs

  • And the winners are...

    Adam Fabio01/17/2017 at 06:34 4 comments

    The 1 kB Challenge deadline has come and gone. The judges have done their work, and we’re ready to announce the winners. Before you jump down to find out who won, I’d like to take a moment to say thanks to everyone who participated. We had some incredible entries. To say that judging was hard is quite an understatement. Even [Eben Upton], father of the Raspberry Pi got in on the action. He created a new helicopter game for the classic BBC Micro. Look for writeups on the winners and many of the other entries in the coming weeks.

    Grand Prize

    brainfckThe grand prize goes to [Jaromir Sukuba] for Brainf*cktor. [Jaromir] went above and beyond this time. He created a computer which can be programmed in everyone’s favorite esoteric programming language. Brainf*cktor uses 1019 bytes of program memory in [Jaromir’s] PIC18F26K22. You can write, execute and edit programs. [Jaromir] ran into a bit of a problem with his LCD. The character tables would have thrown him over the 1 kB limit. Not a problem – he designed his own compressed character set, which is included in the 1019 bytes mentioned above. All the clever software takes physical form with a homemade PCB, and a case built from blank PCB material. Best of all, [Jaromir] has explained his software tricks, as well as included a full build log for anyone who wants to replicate his project. All that hard work will be rewarded with a Digi-Comp II kit from EMSL.

    First Prize

    mosFirst prize goes to [Dumitru Stama] with M0S – CortexM0 RTOS in 1024 bytes. Operating systems are complex beasts. Many of our readers have toyed with the Linux Kernel. But writing a real-time OS from scratch? That’s quite an undertaking. [Dumitru] didn’t shy away from the challenge. He designed a Real-Time Operating System (RTOS) for ARM processors, written completely in ARM thumb assembly instructions. This is no bare-bones executive. M0S has a rich list of features, including preemptive task scheduling, mutexes, and inter-process communication. [Dumitru] even gave us memory allocation with an implementation of malloc() and free(). The OS was demonstrated with a NUCLEO-F072RB board from ST-Micro.

    [Dumitru] didn’t just drop a GitHub link and run. He documented M0S with seven project logs and a 37-minute long video. The video uses electronic whiteboard drawings to clearly explain all the internal workings of the operating system, as well as how to use it.

    [Dumitru] is the proud new owner of a Maker Select 3D printer V2!

    Second Prize

    1klaserSecond prize goes to [Cyrille Gindreau] with 1K Challange Laser. Vector lasers generally take lots of memory. You have to manage galvanometers, laser drive, and perform all the magic it takes to convert a set of vectors to lines drawn in space. The project uses 912 bytes of program and initialized data memory to command an MSP430 to draw an image.

    Proving that flattery will get you everywhere, [Cyrille] picked the Hackaday logo as the subject. The Jolly Wrencher is not exactly simple to convert to vector format, though. It took some careful optimizations to come up with an image that fit within 1 kB. [Cyrille] wins a Bulbdial Clock kit from EMSL.

    Third Prize

    tinygamesThird prize goes to [Mark Sherman] with tinygames. Video games have been around for awhile, but they are never quite this small. [Mark] coaxed the minuscule Atmel ATtiny84 to play Centipede with only 1024 bytes of program memory. Even the BOM is kept small, with just a few support components. Control is handled by an Atari 2600 compatible joystick. Video is black and white NTSC, which is demonstrated on a period accurate CRT. [Mark] generates his video by racing the electron beam, exactly the same way the Atari 2600 did it.

    [Mark] will take home a Blinkytile kit from Blinkinlabs.

    Final thoughts

    First of all, I’d like to thank the judges. Our own [Jenny List], [Gerrit Coetzee], [Pedro Umbelino], [Bil Herd], and [Brian Benchoff] worked hard with me in judging this contest. I’d also like to thank our community for creating some amazing projects. The contest may...

    Read more »

  • Judicial Deliberations

    Adam Fabio01/07/2017 at 08:06 3 comments

    The 1 kB challenge deadline has passed. With 133 entries, this contest has exceeded our wildest expectations! Thank you to everyone who entered. The judges are now hard at work reviewing each entry.

    Keep an eye on this space (or in your feed if you follow the contest) for an announcement of the winners!

    Thanks again to everyone!

  • CPLDs, FPGAs, and hard bootloaders

    Adam Fabio11/23/2016 at 03:15 0 comments

    It's come to my attention that the rules excluded a few architectures which have bootloaders hard coded to run at powerup. An example of this is the parallax propeller, which must run the spin interpreter before firing off a PASM routine. The spirit of the rules is leveling the playing field - not excluding any particular processor. As such I've updated the rules to allow hard coded bootloaders. Check it out!

    Quite a few people have been asking about CPLDs and FPGAs. First off, custom processors instantiated in FPGA's are allowed, and encouraged! CPLD/FPGA external logic is also perfectly fine to use, but remember this is a contest about fitting a lot of function into a little codespace. A ton of perfectly executed Verilog or VHDL code to implement a state machine won't impress the judges as much as a well crafted 1 kB routine. The same goes for Analog or even mechanical entries. Don't worry - there are more contests coming down the pipe for your analog and mechanical hacks!

  • Details coming soon...

    Adam Fabio11/14/2016 at 01:59 0 comments

    Stay tuned for the official rules and details!

View all 4 contest logs

Enjoy this contest?

Share

Discussions

Nick Sayer wrote 12/01/2016 at 19:01 point

I'm using a GPS module in my project, and it occurred to me yesterday that *it* has firmware that I'm not counting towards the 1K limit. 

I guess the dividing line between peripheral and coprocessor will be a matter for the judges to decide.

  Are you sure? yes | no

Adam Fabio wrote 12/06/2016 at 06:26 point

The GPS does - we're going to keep the judging limited to the microprocessor portion of the project code itself. Processing a NEMA data stream with under 1kB of code is impressive itself. 

  Are you sure? yes | no

Nick Sayer wrote 11/30/2016 at 21:28 point

If the source code has a

#define HACKADAY_1K

that when commented out causes a whole lot more features to be available... That's ok, right? As long as the version that does compile down to 1K is (minimally) functional?

  Are you sure? yes | no

Adam Fabio wrote 12/01/2016 at 05:21 point

That's a great way to do it Nick. Perfect!

  Are you sure? yes | no

dumitru.stama wrote 11/30/2016 at 05:54 point

Please forgive my ignorance but this will be my first ever project on hackaday.io and I am wondering if I can store my code on a github account or it has to be here in uploaded files.

Am I allowed to post youtube links with videos where I explain/demo the project ?

Will you count the header part of an executable as well or just the binary data ?

  Are you sure? yes | no

ꝺeshipu wrote 11/30/2016 at 10:38 point

You can keep your code wherever, as long as it's available. You can post your videos to your favorite video hosting service, you can even embed them here in the text very easily.

  Are you sure? yes | no

dumitru.stama wrote 12/01/2016 at 19:07 point

Great, thanks. Do you know if the executable headers will add up to 1024 bytes?

  Are you sure? yes | no

RigTig wrote 11/28/2016 at 09:22 point

Now that the rules are clearer, I declare that my submission (ESP8266 Stepper, by RigTig) uses a Forth interpreter that uses far more than 1K. Besides, PunyForth words consume lots more 32-bit address space than I expected. Since I cannot find an unsubmit button, then I'll leave it to the moderators and judges to take care of it.

  Are you sure? yes | no

michael.mouton510 wrote 11/26/2016 at 18:01 point

Are we allowed to use custom made chips?  Like the one's from https://www.mosis.com/ 

  Are you sure? yes | no

Adam Guilmet wrote 11/27/2016 at 11:15 point

"Quite a few people have been asking about CPLDs and FPGAs. First off, custom processors instantiated in FPGA's are allowed, and encouraged! CPLD/FPGA external logic is also perfectly fine to use, but remember this is a contest about fitting a lot of function into a little codespace. A ton of perfectly executed Verilog or VHDL code to implement a state machine won't impress the judges as much as a well crafted 1 kB routine"

It's like _right_ there...

  Are you sure? yes | no

davedarko wrote 11/25/2016 at 22:43 point

By the way, are there any prizes? I know we're all in for the experience and street credibility for getting featured on the blog and stuff, but I thought I'd ask ;)

  Are you sure? yes | no

jaromir.sukuba wrote 11/25/2016 at 22:50 point

  Are you sure? yes | no

davedarko wrote 11/25/2016 at 22:59 point

too much davedarko in your feed, he? I apologize. [...] Oh dear, I forgot I read that. Yes. I'm sorry, but it should be mentioned here as well, I think. I re-read this projects description before I wrote this comment, I promise! Sometimes I forget that there's also a blog :D and there is this wood thing again. 

  Are you sure? yes | no

jaromir.sukuba wrote 11/25/2016 at 23:18 point

Yep, it should be mentioned here and now it is! :-)

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:17 point

yes there are prizes :) I'll add a the prizes to the description now

  Are you sure? yes | no

Reece wrote 11/25/2016 at 11:16 point

How many submissions can be made per user?

  Are you sure? yes | no

davedarko wrote 11/25/2016 at 11:37 point



I've never seen them restrict you to one, but it will probably be like "oh this one is cooler than the the other one by him" in the heads of the jury and it'll sort it out itself.

  Are you sure? yes | no

Reece wrote 11/25/2016 at 12:29 point

That's cool. :) Thanks!

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:17 point

Enter as often as you like :)

  Are you sure? yes | no

Frater_260 wrote 11/24/2016 at 22:24 point

I have few questions regarding the rules:

> Projects can use multiple processors as long as they are running the same 1 kB binary, or if the total size of the ROM being run is less than
1 kB

Assume I have two binaries (e.g. base station + slave), total size of the two sums up to 1kB. Can the "slave" part run on multiple devices (same slave binary on each device), and "base station" part on yet another one?

> external logic is also perfectly fine to use, but remember this is a
contest about fitting a lot of function into a little codespace.

How far can I go with non-code parts of the project? would creating simple analog RF transmitter/receiver be acceptable, or would it be going overboard already?

> Projects must use 1 kB or less of code, including any initialized data tables, bootloaders, and executable code.

This rules don't mention RAM at all. Is there any limit to RAM I can use? If I somehow managed to write super-uber-AI that creates new code for itself in RAM would it still be acceptable? (however unlikely writing something like that is, lol; but generating data tables on the fly for some interesting effects may be possible)

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:22 point

1) You can have 1,000,000 processors in your project - as long as they all run the same 1 kB binary. 

2) If your project is something that needs an analog / RF section - go for it. Something like a PSK-31 radio with a 1 kB binary would be freaking awesome!

3) No limits on RAM - go wild.

  Are you sure? yes | no

ꝺeshipu wrote 11/28/2016 at 09:24 point

Sounds like the perfect setup for a neural network :-D

  Are you sure? yes | no

K.C. Lee wrote 11/28/2016 at 10:14 point

Actually been thinking of a couple of RF projects, but I am discouraged by the ARM.  Lots of initializations for peripherals and the 32-bit addresses and 16-bit data takes up insane amount of space.  8-bitter just don't have the raw horse power.

I might still try them as this is new stuff for me, but not constraint them to 1kB.

  Are you sure? yes | no

Adam Fabio wrote 12/01/2016 at 05:23 point

@K.C. Lee Even if it doesn't fit this contest, we have more contests being planned. Also - your project sounds pretty interesting - RF and ARM? Sign me up!

  Are you sure? yes | no

Ben Hencke wrote 11/24/2016 at 01:37 point

I hope this encourages some people to get in to assembly programming. I have a ton of fun working with small PICs. A long time ago, I wrote a nestable IF macro library to make working in assembly a bit more sane. I hope this helps some people with their 1k challenge! https://hackaday.io/project/18509-bens-pic-nested-if-macros

  Are you sure? yes | no

Jac Goudsmit wrote 11/23/2016 at 18:34 point

I was thinking of doing a "cheating" entry with my #L-Star: Software-Defined 6502 Computer project where I would emulate a nice little computer and write a <1KB program in 6502 assembler to implement a game, but it's pretty clear that the rules would disqualify me because the firmware would be added to the size. Bummer.

  Are you sure? yes | no

Martin Hub wrote 11/23/2016 at 14:53 point

What about architectures where RESET vector table has to be at the end of FLASH (MSP430)? If I have 1022 byte app and single 2 byte reset vector at address 0xFFFE, does it mean my app is 1kB or 64kB ?

Is it possible to have 64kB binary where 63kB are just 0xFFs?

  Are you sure? yes | no

Mark Sherman wrote 11/25/2016 at 00:24 point

I think that would be fine as long as the interrupt vector table is subtracted from the 1k.  Think about how addressing works.  If you only had 1k of ROM, address 0x3fe at the end of the 1k would be the same as address 0xfffe.  Build a 1k image that has everything you need, and fill up your flash with it.  64k of the same 1k over and over.  This shouldn't be regarded as any different than the multiple-microcontroller rule where they can all have identical copies of the same code.

  Are you sure? yes | no

esot.eric wrote 11/25/2016 at 07:41 point

Sounds reasonable...

As long as you don't make use of the 0xff's inbetween ;)

  Are you sure? yes | no

K.C. Lee wrote 11/28/2016 at 10:20 point

There might be a way to tell the compiler and linker to start the code at the last 1kB.  It would involve some linker script level of work to set the starting address of the right regions.

  Are you sure? yes | no

Adam Fabio wrote 12/01/2016 at 05:24 point

there has to be some equivalent to ORG

  Are you sure? yes | no

Benjamin wrote 11/23/2016 at 11:06 point

What about the internal ROM of a hd44780 display? Does it count to the 1kB?

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:25 point

Yup - all those character tables would blow out the 1kB limit. 

  Are you sure? yes | no

tinu wrote 12/20/2016 at 15:10 point

Assuming you actually use all those charaters. If you use only 10 characters from that ROM only those should be counted.

Most microcontrollers have more than 1kB flash but there you also only count the memory which is actually used.

  Are you sure? yes | no

Hacker404 wrote 11/23/2016 at 09:14 point

There are two things that seem ambiguous to me. 

1) The limit is specified as 1kB and I assume you mean 1024 Bytes and in SI units that is 1KiB whereas 1kB is 1000 Bytes. 

2) Some architectures don't have 8 bit code units like the Harvard Architecture PIC micro-controlers that have up to 12 bit words.

  Are you sure? yes | no

Adam Fabio wrote 12/01/2016 at 05:26 point

1) 1024 bytes. 

2) the longer instruction is a disadvantage to PIC - the contest limit is 1 kB, not 1 k instructions. However, you can still do plenty with 600 or so instructions.

  Are you sure? yes | no

Dylan Brophy wrote 11/23/2016 at 06:54 point

I would like to use an LCD that takes serial input. It came premade from parallax, but it has a micro. Does the code in the micro count too?  I really want to use it.

  Are you sure? yes | no

Mastro Gippo wrote 11/24/2016 at 09:23 point

+1, can I use an ESP8266 with stock AT firmware as a slave for my MCU?

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:27 point

If you use the ESP8266, you would have to count all the AT firmware - which would put you over the limit. That's not to say that ESP8266's can't be used - you just can't have the stock firmware. 

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:28 point

You would have to count the LCD's memory as part of your project. 

  Are you sure? yes | no

Mastro Gippo wrote 11/28/2016 at 08:30 point

Uhm, so this excludes *any* peripherals with firmware, like GPS modules or ELM327 chips right?

  Are you sure? yes | no

Walt Perko wrote 11/22/2016 at 22:41 point

I don't see a "Submission" button ??? How do I enter my "miniPINGbot 1K Byte Demo" into the contest?

  Are you sure? yes | no

davedarko wrote 11/22/2016 at 22:51 point

there should be a submit button on your projects page on the left side under the project pictures

  Are you sure? yes | no

danieljabailey wrote 11/22/2016 at 22:37 point

Suppose I have a 2k program that I can compress to 0.8k and decompress into RAM with a 0.2k decompressor program. My binary would be 1k. Is that acceptable?

  Are you sure? yes | no

Adam Fabio wrote 11/23/2016 at 03:01 point

Yup!

  Are you sure? yes | no

edmund.humenberger wrote 11/22/2016 at 09:05 point

You can design your own processor in an ICE40 FPGA (like icestick, icoBoard, iceStorm, ...) with a codesize optimised ISA and write/run your software from 18kBit of Blockram.

Might be interesting to see a 5 bit CPU which would use the 8kBit much more efficient

A very nice challenge. 

  Are you sure? yes | no

Sam Davisson wrote 11/22/2016 at 03:53 point

Correct me if I'm wrong, but if an interpreter is built in, out of the box, to whatever we are programming (for me a TI-81, with TI basic) would we only count the actual program code we typed in, rather than the interpreter code in ROM as well?

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:31 point

In a case like the TI-81, you would have to include the interpreter, and all the other ROM calls in your 1 kB (printing, etc) - which is beyond the limit. I'm showing my age here : On the TI-85, you could use ZShell to load an arbitrary binary and run it - something like that would be ok, as long as it didn't use any of the TI's ROM calls after Zshell got your program running.  

  Are you sure? yes | no

Tim Trzepacz wrote 11/21/2016 at 22:46 point

If you make your project entirely with analog circuitry, does that count as 0k?

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/21/2016 at 19:10 point

1 kilobytes : 1000 bytes or 1024 bytes ?

In my perspective it's already enormous ! In the context of #AMBAP: A Modest Bitslice Architecture Proposal it's 8192 capacitors (or diodes) or 512 words... Assuming all are 1s so at least 4K diodes :-D

  Are you sure? yes | no

esot.eric wrote 11/21/2016 at 20:36 point

Haha, earlier I was about to ask if @rubypanther was planning 8192+ pull-resistors and some 7400-series muxing :)

  Are you sure? yes | no

rubypanther wrote 11/21/2016 at 20:45 point

Well, the local makerspace happens to have bags of tubes of 7400-series mux/demux in addition to a lot of resistors for long-term memory storage!

  Are you sure? yes | no

Yann Guidon / YGDES wrote 11/21/2016 at 20:51 point

"long-term memory storage" :-D

Freudian slip, probably...

  Are you sure? yes | no

Luobote Beifengchu wrote 11/21/2016 at 20:54 point

1024, gives you a bit more space. Pun intended

  Are you sure? yes | no

Adam Fabio wrote 11/28/2016 at 06:32 point

1024 bytes, or 4096 nibbles, or 8192 bits. 

  Are you sure? yes | no

Eager to get building?

Become a member and discover thousands of projects