The firmware necessary to establish the Scratch and BBC micro:bit communication was built using https://makecode.microbit.org
There is a shared project avaliable here
If you want to rebuilt the firmware, don’t forget to enable “No Pairing Required: Anyone can connect via Bluetooth” in Project Settings.
You can also rebuild the firmware using the code makecode-microbit-scratch-extension.js with config.json settings.
There is a complete development enviroment avaliable on armMBED where you can have total controle of the code used to generate the firmware.