Hi Giuseppe,
Thanks for your information. The paper you provide is really AWESOME. I've read it carefully. In most aspects, I and the author did exact the same thing to the compiler source code. We have met the same problems, faced the same choices and made the same decisions at times : ) This feeling is really amazing!
I choose the Zephyr RTOS to be my hardware abstraction layer rather than implement it based on the chip SDK. Because it's much more easy to support various platforms in the future. The Zephyr project would handle all the low level differences between different boards, chips and even architectures. I just need to leverage the unified API provided by Zephyr.
I also met the binary size problem, I didn't dive that deep as the author did. I just added 'function-sections' and 'data-sections' to the compiler and I got the final binary size around 2MB. If we don't want to create any third party "micro standard library", we still need some hard work to handle this problem. I agree that some linking time optimization is needed to eliminate the dead code. It's another aspect besides the compilation procedure.
The current status of the hardware:
I have designed this SwiftIO board based on NXP i.MX RT1052. This chip runs at 600MHz, amazing! There are plenty of different IOs on the board: digital, analog, pwm, i2c, uart etc. There are 32MB SDRAM and 16MB hyper flash to run the code. An on board DAPLink debugger to download the binary just using drag and drop.
Here I met the first problem. Since the binary size is around 2MB, it costs more than one minute for downloading to the flash chip. Even I used a very expensive Hyper Flash for this first version. This is unacceptable. Even more, it can't be improved in a short time. Neither speeding up the download process nor decreasing the binary size.
Now I'm changing the strategy. I made a bootloader for the board. When booting, the board can enter two different modes:
- Run mode: Copy and run the binary in SDRAM which is stored in the microSD card.
- Download mode: Connect the microSD card to the computer as a USB disk.
Normally, the bootloader would enter Run mode. When press a "Download" button on the board, the USB Disk would appear immediately in the computer.
Till now, the whole process is really smooth : )
The current status of the IDE:
As I mentioned previous, making an Arduino like IDE is my first target. I'm not good at GUI programming, I found one of my friends to help me implement this MadMachine IDE. It's based on the electron framework, so it can run on different OS. It's supper easy for any beginners to touch Swift language now, no matter what kind of operating system is. You just need to import SwiftIO framwork, write your own code, press compile, then every thing is done automatically.
About the SwiftIO framework:
import SwiftIO
func main() {
//Create a DigitalOut to .D0
let pin = DigitalOut(.D0)
//Reverse the output value every 1 second
while true {
pin.reverse()
sleep(1000)
}
}
I made an Arduino/MicroPython like framework called SwiftIO. You can visit the existing API here (It's far from complete till now). Since I'm not a Swift expert, there must be some better way to implement the API in a more "Swifty" way. Hope the experienced Swift user could help on this aspect. This ia a reason why I want to release it as soon as possible.
I named this whole project "MadMachine", and I created a website for this project: madmachine.io, the github page is MadMachine · GitHub
This project is still very young. It's really a lot of work. I plan to make a small-batch production for the beta version hardware in October. I need to focus on document right now. I think I can give some update in September. I really want to speed up the process. But hardware project is not the same as pure software project, it costs not only time but money to prepare all the specific components.
All the parts of this project would be open sourced. It's really amazing to use such a modern language in embedded development 