Posts

Dear Goodness

 I removed Xcode, but it has left its "command line tools" behind like a stain. I can't even delete them as root. This is ridiculous. This is how Apple gets a bad name for making your own machine not your own... rm: /usr/bin/make: Operation not permitted sh-3.2# cd /usr/bin sh-3.2# ls -l swift make -rwxr-xr-x  1 root  wheel  18288  4 May  2019 make -rwxr-xr-x  1 root  wheel  18288  4 May  2019 swift sh-3.2# open . sh-3.2# rm -r swift override rwxr-xr-x  root/wheel restricted,compressed for swift? y rm: swift: Operation not permitted sh-3.2# rm -rf swift rm: swift: Operation not permitted sh-3.2# ls -lO swift -rwxr-xr-x  1 root  wheel  restricted,compressed 18288  4 May  2019 swift sh-3.2# chflags -hv norestricted swift chflags: swift: Operation not permitted sh-3.2# whoami root sh-3.2# I mean... what do I do?!

Making C++ wrapper libraries for Swift for Arduino - part 1

I have just started adding a library to use the Adafruit Bluefruit LE, which is a great little shield made by Adafruit. Problem is, as ever, their software they give away is to make the shield work with Arduino/C++. What to do? Since version 2.9 of Swift for Arduino, it has been possible to use a special category of library files in addition to the usual ones from the community github site. Just like the usual library files, these are of the form XXX.swift, are all kept in the github community site for general use (https://github.com/swiftforarduino/community see the community libraries). This new type are named unsafeXXX.swift to be clear that they contain a core of unsafe C++ (usually legacy) code. In nearly every case, the code could be ported to pure swift at some point but it can be a lot of work, so in order to make it possible to get up and running faster and to leverage existing legacy code, it can be wrapped in Swift. The basic way this works is this: 1) make a new p

My opinions of code signing, notarising and the hardened runtime

 I had a long rant/chat on Slack about what I've figured out about code signing and notarisation after many late nights. Someone pointed out I should make a blog post about my opinions for posterity, even if it's not 100% accurate (I'm sure it's not), it will be helpful for some tidbits, hopefully. ... The way the bundle is structured, it has a standard structure, Contents containing the actual executable in MacOS, resources in Resources and helper service applications in XPCServices. The two services are the simduino plugin, which is basically a wrapper around simavr and the build engine. The main app is codesigned in the standard way, code signing is a slight misnomer. Carl  12:28 PM “Code signing” is essentially the same process as signing a document or file using PGP or GNUPG, the cryptographic program has a certificate and private key pair, which are equivalent to a public/private key pair in RSA signing, it takes the document, makes a cryptographically secure hash

Where do all my bytes go? ... an analysis of program size in an S4A 4.0 series application

You heard it here first, but coming this year, we are finally releasing the version 2 compiler, as part of Swift for Arduino release 4.0. This is a very exciting new development, with our own patched swift frontend and (most importantly) a custom built standard library, fine tuned for the atmega328p and the arduino uno.  There is most definitely nothing else like this anywhere in the world. Another first! As part of this launch, I'm going to try to do some more blog posts about day to day findings and experiences with making AVR/Arduino programs using our new compiler. As an example, I just compiled this program... import AVR SetupSerial() print("newer API") public let dummyArray = [1,5,9,112,0,1,4] print(dummyArray.count) while true {} This is a super simple program demonstrating some of the powerful new features of version 4.0, namely our custom made strings and our customised arrays. Both are super efficient on a microcontroller and we have removed some

Sipping power... sleep modes and Swift for Arduino

Image
One feature I have been meaning to add to S4A for a while now is sleep. It might not sound like an important feature but it could radically change the way projects are made. A critical distinguishing feature of S4A is that it creates true native programs for the atmega328p microcontroller, meaning you don't need to have an Arduino UNO, plugged into your laptop or desktop via USB for these programs (although of course you can). This sets it aside from many other attempts to simplify Arduino programming in the past, that effectively run programs on a full PC/Mac then send serial commands to the board to activate it. The next step... how do you make a project that lives on batteries? Well, right out of the box you can do that, at least for a while. See my Hallowe'en project from last year on this blog that I made for my daughter. But that lasted a couple of days on batteries before it faded. Anything with lots of lights and motors is going to need a lot of battery, of co

Swift for Arduino newsletter - Saturday November 16th 2019

Hello to the Swift for Arduino community! We are so excited to get in touch with you and let you know what's going on. First and foremost... Black Friday/Cyber Monday! We are giving away huge discounts! *** The Swift for Arduino Starter Box... HALF PRICE!! *** (Contains a Seeed Studios Lotus board and connectors, you don't need any of your own hardware, get started right away!) Note: to use this discount, you must enter the discount code BFCM50 in the Shopify store during checkout. This discount is limited in time and number - don't lose out! Offer available from 00:00 on Friday 29th November, closes 23.59 on Monday 2nd December 2019 (For convenience, you can use this link:   https://s4a-elements.com/discount/BFCM50?redirect=%2Fproducts%2Fcopy-of-s4a-silver-standard-box ) *** The Swift for Arduino IDE - license only... 70% OFF!! *** (suitable for customers who already have an Arduino UNO or similar board) This d

Grove PIR sensor

Image
As you can see in this video, I've hooked up a simple program to change the colour of a strip of neopixels in response to detecting people passing by. See example code here: https://github.com/swiftforarduino/community/tree/master/work%20in%20progress/Grove%20Examples/Neopixel%20person%20sensor.swift4a But this is an easy project to write.