The Swarm

I’ve been in the head space again to do a little writing and decided to write an experimental story about a closeted transfem who meets an alien who changes here body. Hope people enjoy it!

Note: I originally posted this on Scribblehub and you can find all my work here: https://www.scribblehub.com/profile/80985/geekylou/

It was the last day of university and Jack was dreading it. He’d put off this day as long as he possibly could by going to college and then university but tomorrow, he would finally have to do his compulsory military service. It could be worse though Jack thought, at least he would be relatively comfortable aboard a navy survey ship. Jack had always been quite skinny and hated physical activity, the thought of being sent to army training had terrified him. 

That evening Jack started packing his belongings to go into storage while he was away on military service. After he had finished packing, he settled down in bed and watched entertainment programs on his viewscreen till he drifted to sleep. 

*** 3 Months later ***

Jack had hated every minute of the training he had been given. He also spent most of it alone as he didn’t get along with another of his fellow conscripts. Due to his education though he had easily slipped into a maintenance position when it came time to join the crew of the survey ship. He spent most days in the ship’s maintenance shafts fixing the numerous faults the ship had.  

Ship maintenance is poor in the Navy and the Navy’s survey ships are its lowest priority. The only thing keeping the survey ship in space was Jack and the other conscripts counting down the days till the end of their military service and freedom. 

Today Jack was not the best as he and the other members of his maintenance team had been dressed down in front of the head of engineering. He hated being on the ship and he hated his crew mates. “How am I going to survive another nine months of this,” Jack told himself. After a long day he found a time when the ship’s communal shows were free so he could be alone, he had a shower and tried to sleep in his bunk.  Eventually, the day’s exhaustion overcame him, and he drifted to sleep. 

As the crew slept, the ship flew through a patch of millions of microorganisms who referred to themselves as the swarm. The ship was warm and inviting compared to the coldness of space and their tendrils looked for a way in. They found it in a badly maintained airlock and made their way in. “There is sentience here,” they said to themselves as they passed by the bunks of crew sleeping. They stopped by Jack’s bunk. “This sentience is in pain; we can feel it. We can fix it” they said as they probed his skin and entered his body. 

That night Jack had the strangest dreams, he dreamt of faraway alien worlds and strange planets.  We woke up exhausted that morning wishing he could have stayed in bed forever.  Another day aboard ship to himself as he got dressed and made his way to engineering. Jack took his tools and made his way down the access shaft to one of the power conduits. At least he would be spending the day in the maintenance shafts, with any luck he might be able to avoid the head of engineering. 

Jack was feeling exhausted after his day and after eating his lunch he returned to his bunk for an early night.  That evening Jack had vivid dreams again, this time he was walking through an alien forest, but something was different. He stopped as he saw the reflection of a woman in the water. It wasn’t the first dream he’d had where he was a girl. He’d dreamed it most nights when he was younger. But tonight was different more intense, it felt like this was his body. It felt weird, but good. 

As he was walking through the forest he heard a voice. “We saw you in pain and fixed your form to remove that.” 

“Who are you?” asked Jack in a feminine voice. 

“We are the swarm” replied the voice. 

“The swarm?” 

“Your ship flew through us. It was warm so we entered it and saw you. So much pain. We can fix that. Change your form into the form your subconscious has now.” 

“I can be a girl” Jack thought to themselves in the dream. Something inside Jack was yearning for this and this was just a dream, wasn’t it? It wasn’t real. None of the inhibitions or worries about what other people would think were holding her back. 

Jane woke up. What a weird dream they thought to themselves. As she woke up, she brushed her long blond hair away from their face. Wait! What! Long hair and why does my crotch feel different. That’s when she started panicking. This is real, everyone going to look at me and wonder who the strange woman is in Jack’s bunk. They will throw me in the brigg, or worse. 

As Jane was panicking that didn’t happen. James one of the other crew members turned and said to them “I think the other crew have finished with the shower so it’s all yours if you want to use it, Jane.”. “This is so weird why is no one bothered by this,” Jane asked herself. 

“We altered their memories.” said a voice in her head. Jane decided to skip having a shower and picked up her tools. She needed to think and the only place she could go to be alone was the ships service ducts. 

“This is not happening,” Jane told herself in the privacy of the service duct. 

“I can’t be a girl this must be a dream.” 

“We can change your body back. If you wish it?” said the voice in her head. 

“No” replied Jane. She was confused. Why did the thought of changing back horrify her? She’d spent her whole life being a Man. Yes, she’d dreamed of being a girl, most nights when she was younger, but all men did that, didn’t they? 

At that moment Jane’s data pad illuminated, and pages and pages of text scrolled through the screen. “From our scanning of your civilisations data, we have determined that most people of your species designated as male do not wish to be designated as female.” The voice in her head said. 

“You’re not a dream, are you? You’re real.” Jane asked. 

“No, we are very real. Can you help us?” The voice asked.  

“Help you?” Jane asked. 

“Help! You can change bodies, and change people’s memories. What could you possibly need from me?” Jane asked. 

“We were studying this system when our ship was destroyed. We need to send a message to others so we can rejoin them.” 

“We could change and manipulate the crew but there is always a risk of injury if we do. We only did what we did in your case as you were in so much pain.” 

Pain? Jane thought to herself. Yes, her head felt clearer and there was somehow she felt so much better in a way she just couldn’t pin down, but pain? She wasn’t feeling that bad, was she? 

“So, you want me to bypass the communications relay and send a message?” Jane asked. 

“Yes!” replied the Alien consciousness in her head. 

“And what happens to me? The crew might don’t know any different but when the ship returns people will ask questions. I’ll probably be arrested as a spy or worse.” 

The voice was silent. 

“You could come with us?” The alien voice asked. 

Jane thought about it. It was an impossible choice. It had only been most of a day but every time she thought about being a guy again, she just recoiled from thinking about it. She couldn’t go back, but could she go forward. She would be alone around aliens, with no other humans for company. 

She thought about it for most of the day before deciding. 

“Here goes nothing,” Jane said as she plugged her data pad directly into the comms relay. A signal was sent, now the only thing left to do was hope she wasn’t caught, and the aliens received the signal. 

*** 1 Month later *** 

Jane was sitting in the mess hall when suddenly the lights went out and the ship lost power. “Red Alert, Red Alert” a robotic voice said repeatedly as the emergency lights came on. All power on the ship was out as she rushed to the engineering deck along with the other members of the engineering crew. 

“No!” said the Alien voice in her head. “We must go to the airlock.”  

Jane headed to the airlock and gasped at what she saw through the window. Instead of the blackness of space was a blue pulsating corridor of an alien ship. 

She looked back one last time before leaving humanity behind. 

The aliens were true to their word and did their best to make Jane’s life as comfortable as possible, she had a small comfortable house in a clearing of a strange purple forest. Her and the alien hive mind taught each other about each of their civilisations and as the years went from one to the next, they became closer. Her consciousness started to join with that of the alien swarm until she was no longer entirely human. Even though she was happy she still missed other humans and wondered if she would ever meet them again. 

*** 100 years later *** 

Jane awoke something terrible had happened the humans had damaged the hyperspace for hundreds of light years around their home world stopping all travel. If the damage spreads, it could be a problem for all sentient life in the galaxy. They consulted the other swarms of consciousness on their planet, and it was agreed that Jane would travel to the nearest human world and make first contact. 

Jane walked down the ramp from the shuttle. Their dress glowed and pulsed with energy as it moved with their body. 

“It’s a pleasure to meet you ambassador, we are Jane,” said Jane. 

The ambassador looked at Jane in surprise. “And a pleasure to meet you too we certainly weren’t expecting to meet someone humanoid for first contact.” 

“Well, this isn’t exactly first contact, part of us was human long ago. But that is a long story,” said Jane. 

The End – for now.

Backup fail

So a few weeks ago our trusty NAS’s hard drives decided to be unhappy. No worry I thought as I shut down the NAS and replaced the HD with a spare. Unfortunately, the HD enclosure decided that it time was over and never came online again.

No worries I thought, I’ll just order a replacement. The replacement duly arrived and I transferred the hard disks to the replacement unit. All was well till the following Sunday when I woke up with I/O errors when I ssh’d to the machine. Checking MDADM showed that all 3 drives had detached from the enclosure. Luckily after a reboot everything came back and I decided to monitor it and make sure everything was backed up.

Backups were running and I thought that even if it all went down I would be able to restore from back-ups. I would be safe or so I thought. Sure enough, the NAS did the same thing the following weekend. This time sadly the raid5 array did not come back up. To compound matters the backups or the machines home directories consisted entirely of symlinks. Luckily I had a single backup of my home directory. Siobhan was not so lucky. We also lost the contents of an old hard disk from the laptop from my pre-transition days.

We recovered what we could and rebuilt. This time I decided to try out using LVM to run the raid rather than doing it at the disk level with MDADM which wasn’t particularly successful. Each time I set up a test RAID1 volume it would complain about a bad superblock on reboot. At that point I decided enough was enough with using ARM SBCs with their older Linux kernels and just decided to replace the SBC with a second-hand desktop PC.

A new PC was acquired from Ebay and arrived that week. It’s a lot bigger than the old SBC but it runs the latest debian and doesn’t consume huge amounts of power. It’s a bit overkill but has been stable so far which is the most important thing.

Comms Troubles

I wrote a little snippet for a story up working on where the characters have problems all too familiar to anyone who’s used video conferencing:

We all met Chloe in the briefing room. Our survey ship was in orbit and Sophie its Captain was going to give us a status update over videolink. After a short while the accept call prompt came up on the screen and Chloe clicked the icon to accept the call.
Sophie’s image appeared on the screen and we saw her lips move but couldn’t hear her. “I think the audio settings must be wrong, let me take a look at the console.” Said Lisa our IT tech. Lisa fiddled with the settings and disconnected then reconnected the external speaker unit. “Can you hear us now?” said Lisa.
“Hi Lisa, sounds like everything is working now,” said Sophie on the other end of the link. At that point, the screen went blank and the buffering symbol appeared. I rolled my eyes nothing works on this planet, does it?

I wrote a thing

So I’ve been thinking about writing and how cool it would be to have a fictional world where only women have a special power (like Bene Gesserit’s in Dune) and doing it in a trans inclusive way.

So I wrote a little short story about a trans women named Alice finally getting to grips with using her powers to guide ships through hyperspace. Hope you enjoy it!

Alice in Hyperspace

It seemed like a good idea at the time. Get the best resources in the galaxy to help me with my transition. Get injected with alien nanobots that give you superpowers and in return, all I needed to do was join a mysterious sisterhood of women to guide starships safely through the increasingly chaotic regions of hyperspace in the core. 

The only problem is I’m useless at it. My instructor sent out five hyperspace probes for me to guide to Alpha Centauri today and the best I’ve managed is for one to turn up in Barnards Star. Who knows where the others are probably lost somewhere in hyperspace never to be seen again. 

*** 

After our practice session, we all went to the ship’s mess hall to unwind after the day. 

“How did it go today? Is anything starting to click yet?” Lisa said to me. 

“I still can’t get even one of the training probes to the right destination. One ended up in Barnards Star and the rest lost in hyperspace who knows where.” I said. 

“Remember Lisa all the problems I had. I struggled for months and months and then one day something clicked and suddenly I could guide everything to the right place.” Anna said. 

“And don’t forget your six months behind us in training. Considering how long you’ve been doing this you’re doing well!” Anna said. 

“I guess,” I said. 

*** 

That morning Maria my instructor popped her head through the door of the mess hall while we were having breakfast. “Anyone want a break from navigating practice probes to the far corners of the federation? I’ve been invited to a banquette on Haven.”  

“Why don’t you go, Alice? A break might be what you need right now.” Anna said. 

“I don’t know. “ I said, “I’m not great at social stuff”. 

“It will be good practice for when you graduate and have to get involved in interstellar intrigue and diplomacy,” Maria said. 

“Ok then, I’ll come,” I said. 

*** 

I felt nervous walking to the scout ship.  

“This is a terrible idea. Why did I agree to this?” I said. 

Maria looked at me and said. “You will be fine I used to do state banquettes all the time when I was younger. You just need to stand around looking pretty and acting like you own the place.”  

“That’s kind of difficult when you grew up on a farm and everyone thought you were a boy,” I said. 

“Yea, but no one knows that. To them, you’re practically royalty.” Maria said. 

The jump through hyperspace was only a short one. Our little scout ship was fast and only took a few days to make the journey to Haven. 

As we made our final approach, I finished getting changed and met up with Maria in her quarters. Make-up is something I still struggled with, so I needed a bit of help getting ready. After we had finished getting ready, I looked myself up and down in the mirror. I knew in my head that all anyone saw when looking at me was an attractive young woman, but brains are good at lying to you and I saw all the flaws that had gone long ago. 

The ship landed smoothly on a pad at the starport and we prepared to leave. As we walked down our shuttles boarding ramp and onto the red carpet an honour guard stood to attention. We walked down the red carpet to the awaiting transport pod that would take us to the governor’s mansion. I’m not sure I’ll ever get used to being treated like this I thought. 

*** 

I sat awkwardly at my dinner table. As guests of honour, we were at the head table with the planetary governor and his family. The governor was talking to Maria about how sorry they were about the incident with their diplomat on our homeworld. I sat there staring at my datapad, I’ve never been much good at small talk.  

After a while, my datapad lit up with a message notification. Maria must have a neural link to hers active as she was still talking to the governor: 

Maria: How are you holding up? 

Me: Not sure. I’m sure everyone is staring at me. 

Maria: They are. They are staring at both of us with a mixture of fear and wonder. Try to enjoy the attention. 

Me: Ok, I’ll try. 

Maria: It takes time, but you get used to it. You’re doing really well so far! 

After dinner, I decided to get some fresh air and made an escape towards the mansion’s gardens. The gardens were lit by a combination of mood lighting and the system’s other star. It was nice to escape to the quiet and enjoy the fresh air and I don’t think anyone noticed I was gone. 

After spending the night in the governor’s mansion, we headed back to our ship I couldn’t wait to be back somewhere I could get out of this dress and go back to my usual outfit of jeans and a tank top. 

*** 

I breathed a sigh of relief as the ship accelerated out of the planet’s atmosphere.  

“I know you’re not a social butterfly, but it wasn’t that bad, was it?” Maria said. 

“It’s just social anxiety, I’ve never quite got over all the stuff that happened on Earth before I joined,” I said. 

“I remember that time when we first met,” Maria said. “I’d escaped my security detail to get some air and time alone and I saw you sitting alone in a park crying.” 

“I don’t know what I’d of done if I hadn’t met you then,” I said. 

I didn’t like thinking about those times. I’d come to Earth full of hope that I might finally find somewhere safe where I could transition, but it wasn’t to be. When Maria found me, I was very much in that awkward early stage of being on HRT. It had made me a target of bullying at college and that day everything had just got too much. 

Maria nodded and said, “I’m sorry if last night was a bit much for you too soon.” 

“I kind of forget that not everyone was brought up in a royal household and taught that they were the prettiest one there and to be the centre of attention at a young age.” 

“How comes you’re not still there?” I asked. 

“Well, let’s just say the planet is a republic now. Me and my mother barely got out with our lives and my father wasn’t so lucky.” Maria replied. 

“I’m sorry,” I said 

“Don’t be. My father was a despotic arsehole.” Maria said. 

I decided not to ask any more about Maria’s past and retired to my bunk for an early night. After yesterday I needed the rest.  

*** 

I woke up to the sound of emergency lights and klaxons. What’s on earth is going on I thought. A klaxon sounded and a robotic voice said “Life support failure, emergency oxygen and CO2 scrubber activated.”. I rushed to the Bridge and looked in horror at the captain trying to treat Maria with an autodoc. She was unconscious. 

They looked at me and said, “The main intrasystem drives down, we only have a day’s Oxygen left and we need to get Maria to a proper doctor.”. With the main drive down the only place we could get to in time would be the survey ship in the next system and the only person qualified to get us there was currently unconscious. Either I navigated the ship through hyperspace, or we would die. 

“The only choice is for me to guide the ship through hyperspace and I’ve only ever done this with practice drones. “ I said. 

“Agreed Maria is in no state to guide the ship, I’ll put her in a stasis pod which should stabilise her condition.” Said the Captain. 

I activated the neural link to the ship’s systems and established communications with the jump gate. Luckily for us, the conditions in hyperspace weren’t terrible. I spent about an hour searching till I finally found the beacon for the gate where our survey ship was. I didn’t want to risk the hyperspace getting more turbulent due to a passing ship, so I immediately commanded the ship to make the jump. 

Shit, I thought as we immediately started to drift in the wrong direction. I fired the thrusters to push us back on course and overcorrected. We were now drifting off course in the opposite direction. After about an hour though, I got our course stable and with a few course corrections we made our way slowly to the other gate. I breathed a sigh of relief as we reached the gate and we re-entered normal space. Luckily the survey ship wasn’t far from the gate and help arrived soon. 

***  

A week later the doctor was finally well enough to have visitors, so I went to see her. Maria was laying bandaged in bed in the med bay. 

“How are you doing?” I said to Maria. 

“I’ve been better. All I remember is the ship hitting some space debris and that was it,” she said. 

“The doctor said you guided the ship through hyperspace and saved us. I’m so proud of you!”  

I blushed and didn’t know what to say after that. 

*** 

It was three months later and I was feeling really nervous. Today I would be piloting the science ship through hyperspace myself for hopefully the last time before I become a qualified navigator. If everything went well today, I’d be assigned to a ship of my own.  

“You have control of the ship,” Maria said. 

I activated my neural link with the ship and the ship faded away to be replaced with a view of hyperspace. I concentrated on our destination and saw the bright flashing beacon of the destination gate. I then commanded the ship to enter through the gate. I felt the ship try to drift of course but quickly commanded the ship’s thrusters to counteract it. 

After a few hours, the ship safely transited out of hyperspace. 

“Congratulations. That was very well piloted. Looks like you’re ready for your own ship now.” Maria said. 

A few days later I received orders to report a freighter named the Eris. My new home. 

Epilogue 

Guiding this slow, rust bucket of a freighter was getting routine now. Most of my time was spent trying to find things to do to occupy my time for two/three months followed by a couple of weeks of intense concentration to get the big old ship through hyperspace safely. I’ve been doing it now for three years and I love it. The crew feels like a big family. I just wish they let me help out sometimes with maintenance and stuff as there’s not much to do when we are travelling to the hyperspace gates and back. 

It looks like I’m not going to be on my own with nothing to do for this journey though. We have a passenger and oh my god they are such an egg. Cute though. 

The End 

My experiences of game streaming

I recently bought myself a new laptop so me and my partner can still do computer stuff when we are in the living room and I’m away from my desktop. As I didn’t want and couldn’t afford a gaming laptop I planed to use game streaming from my desktop so I could play games with decent quality.

Below is my experiences of each option that I tried.

Steam offers has two methods for game streaming from one local machine to another. The first of these is the steamlink app/application that can run on Windows, Linux (both PC & Raspberry Pi) and Android. I’ve found this to work really well although I did have some issues with the wifi on my PC so using a wired ethernet adapter can work a bit better. Quality can be pretty much identical to running it on a local PC (apart from my laptop not getting so hot).

The steam application can also use do streaming internally. The only problem I found with this was that you need to be logged in on the host machine or you just get a blank screen. This can be solved by either using a VNC client or using the steam link application.

Moonlight and Sunshine (if you have a AMD gfx card)

Moonlight emulates the nvidia game streaming as used on the nvidia shield. This offers very good quality and you can also pair it with the sunshine streaming server if you don’t have an Nvidia graphics card. The main issue I have with it though is that it doesn’t work well with my WiFi. I suspect this is due to having spikes of requiring a lot of bandwith that our WiFi can’t handle. Over a wired ethernet connection however it works very well.

Xbox cloud gaming

This differs from the above options in that games are streamed from a server in a data centre rather than you own hardware. In order to use it your require a XBox game pass ultimate subscription and you can only play the XBox version of the games available for cloud gaming. Quality is limited by only support 720p resolution and I saw some graphics glitching. I did find it useful for trying new games without downloading them to either of my PCs and it might be a good option for playing away from home.

Transport Fever 2 – German valley main line

Introduction

I’ve recently been doing another play through of Transport Fever 2. This time I wanted to create a map with a lot of scope for fast express services so I created a long thin map where a single main line could connect most of the cities together.

I’ve currently paused things at about 1987 and am moving over to use more modded vehicles so things look much better.

Theme

The current map theme is a fictional river valley area in Germany near the French border. German ICE trains are currently not ready so high speed services are currently being provided by orange first generation TGV sets. There is also a fast intercity service provided along part of the route using rhine gold couches hauled by DB Class 103 locomotives. Various other locomotives haul services off of the main line and it’s various branch lines.

Route map

Route map of all lines in my map

Space Engineers: All the Ice I’ll Ever Need! and my new ship scripts.

I’ve been spending some time playing about with scripting in Space Engineers recently. My latest creation is a remotely controllable mining machine which uses a programmable block to allow user input to be used to control pistons. It also has a pan/tilt camera mechanism for checking everything is connected.

With this I don’t think I’ll be running out of ice anytime soon as it can crawl down the conveyor rail to go to any depth.

In order to make shipping the hydrogen produced by it easy I also designed a hydrogen tanker.When this is on the ground the main engines can rotate downward to conteract gravity and then they can swivel to a vertical position once the ship is in a climb or in space.Ths ship also features a jump drive so it can transport hydrogen between planets.

Scripting

In addition to the simple scripts I wrote for the ship and mining maching I’ve also been updating my status/airlock script to be much nicer looking using the sprite interface.

This allows viewing the quantities of hydrogen, oxygen, uranium and battery charge in an easy to see graphical format. This is much better then the text display I had before.

I also have airlock status displays so you can compartmentalise ships and stations and lock the door if one area is presurised and the other isn’t (which is great for making airlocks).

The next things I’d like to do is build a docking display script to make docking easier and some communication scripts to implement store and forward communications using laser antennas.

Making TeleText/RustText pages

This is probably a bit premuture as I haven’t implemented HTTP yet in RustTex but I thought I’d do a short post on making pages for RustTex (you can also use the same pages with a teletext emulator).

I use a program called wxTED to create pages for RustTex. This is primarily designed for TeleText so the RustText file handler has to do a few things to make sure they display properly on a BBC micro/BeebEm.

wxTed presents a GUI which allows you to enter text. You can do line drawing by using ctrl-F? (F1-F9 for the colour). In graphics mode you can use q,a,z,w,s,x to change one of 6 blocks inside the character location. It also lets you set the background colour and do lots of other stuff. Check out it’s help pages Help->Special keys and have a play.

If the Internet had been become popular in the 80s.

Background

It’s 1985 in a parallel universe where Europeon telecoms companies have understood the need to bring down costs and install a new digital communications network based on ISDN.

In parallel Minicomputers and Mainframes are being joined together to better share information between companies and academic institutions using packet switch. They all agree on a information sharing agreemement that mirrors the current internet where costs are shared and the system is opened up to indviduals.

This is a small project to imagine what the reader would experience if this had happened and their newly purchased LOUCORP9000 ISDN modem arrives through the door ready to be connected to their BBC Microcomputer.

In order to connect a real PC to your local PAD (which is what RustTex does) you will need to run the tcpser program and the Beebem BBC micro emulator.

How to install

Download beebem from http://www.mkw.me.uk/beebem/ and install it on your PC. Versions are also available for Unix and I think mac.

You will then need to install tcpser to allow you to emulate a modem. You can download it from http://www.mkw.me.uk/beebem/tcpser.zip . Unpack the tcpser zip file and launch the GO.bat file.

Then run BeebEm. From the comms menu select RS232 destination and select localhost:25232 I’ve not had much luck connecting directly to RustTex yet so for now your have to use tcpser to connect to RustTex.

Then follow the instructions in the pamphlet below. Your phone no. is the IP address or hostname of the machine running RustTex (localhost if it’s the same PC as your running BeebEm).

Your LOUCORP9000 ISDN modem.

Congratulations on purchasing your LOUCORP9000 ISDN modem. Your ISDN modem provides the very latest technology which will allow you to connect to your local PAD (packet assembler/disassembler) and experience the internet at speeds of up to 9600 baud.

How to connect your ISDN modem to the Internet

Connect your modem to you ISDN line and connect it’s serial port to the back of the BBC micro. Once the modem is connected then you will need a terminal emulator running on your BBC micro. Below is a simple BBC basic terminal emulator your can type into your BBC micro.

10*FX2 2
20*FX7 4
30*FX8 4
40*FX229 1
50REPEAT
60  A%=138:X%=2
70  IF ADVAL(-1)>0 AND ADVAL(-3)>0 THEN Y%=GET:CALL&FFF4
80  *FX2 1
90  IF ADVAL(-2)>0 THEN VDUGET
100  *FX2 2
110UNTIL0   

Enter the code above and don’t forget to save it to a disc or tape using the SAVE “filename” command! You can now run the terminal emulator using the RUN command.

How to connect to your local PAD

In the terminal emulator type AT and press the return key. The ISDN modem should return with OK. To connect to your local pad type the following, where phone number is the phone number of your local PAD.

ATDT <phone number>

For example you could type ATDT localhost

This will connect to the PAD and you will get a screen similar to the one below.

From here you can get help by typing help! Refer to the documentation of the PAD you are dialing into for more information.

Rusty STM32

Introduction

So I’ve recently being have a play with building software in Rust for my Nucleo F7 dev board. As I didn’t really fancy writing USB drivers and wanted to have a play with ST’s STM32Cube drivers I thought the best course of action was to mix C and Rust together in one project.

Setup

For this project I decided that I would use the rust build system (Cargo) and link my C code via a static library. The Embedded rust book (https://docs.rust-embedded.org/book/) gives a good walkthrough on what is needed to build and link a project and get setup with something simple that can print ‘hello world’ via semihosting on the debugger and I did this before adding any of my C code.

As I’m using Visual Studio Code for development currently Cortex-Debug VS Code extension (https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug). This enables debugging using OpenOCD via ST-Link SWD board on the Nucleo development board. For this kind of project having a debugging capability makes life much easier.

Creating the C setup and drivers

The first thing that can make life a lot easier is to use the STMCubeMX program from ST to build an initial setup C code project that will initialise the clocks on the CPU so they are all running at the correct frequency. This utility has some templates for the Nucleo series boards that would also be a good starting point if you are using something else like the STM32F4 Black pill board or your own custom CPU.

I used this to build a initial project with a serial port and several integrated peripherals then renamed the main method to an init method (and made it return) that can be called from the main rust code.

I did find one gotcha in this in that it looks like the rust init routines do not clear the processors ram before running. This gave the symptom that the serial port would work when the ST-Link windows utility was run but not at any other time so it’s important to manually clear the gState vairable (and probably others) before you initialise the HAL drivers. I’m currently initialising each HAL driver from the C code but this could also be done in Rust (and in that case all initialisation has to be done explicitly).

Creating the Rust code

The Embedded Rust book (https://docs.rust-embedded.org/book/start/qemu.html) provides a good overview on how to setup the Rust side of things. I followed this and got a simple program to output ‘Hello World’ via Semihosting on the Debugger. One thing to note is that the debugger will hit a breakpoint when outputting each character if you don’t enable semihosting on OCD. Using hprintln is also recommended over itm as the later won’t work if you don’t have the SWO pin connected.

In order to link your C code to your rust code you will need to modify the build.rs I added the following lines to mine:

    println!("cargo:rustc-link-lib=static=<stm32-c-library>");
    println!("cargo:rustc-link-search=native=<src-dir>");

This will tell Cargo to link your C code with the rust code when building. For the above example I placed the C library .a file in the source root directory, though for less experminental projects it would be better to create a lib directory. You can then use an extern “C” directive to tell the rust compiler about your C functions. Here is a simple one below:

extern "C" {
pub fn c_main();
pub fn HAL_IncTick();
pub fn SystemInit();
}

As the Rust cortex libraries handle the Interrupt table it is very important that you define an interrupt handler for the SysTick interrupt. Not doing this will cause the board to get stuck in Rust’s DefaultHandler which will just loop forever. The SysTick interrupt is also very important for the STM32 Hal for tasks such as the delay function so the SysTick timer should at least have the following:

#[exception]
fn SysTick() {
    unsafe { HAL_IncTick();};
    //hprint!(".").unwrap();
}

My next steps

Now I have something that works I want to have a go at getting Futures working and changing over the STM32F4 black pill for the bulk of my coding. These STM32F4 boards are much cheaper and should have plenty of ram to run most the things I’m interested in.