How to get started to write a drone flight code

I need to write a code that would make drone fly in certain shape, say in shape of a star. I am not sure if I should be working on the firmware code or any abstraction is present. How do I get started? Can someone point me to a link of documentation. Thank you in anticipation.

It is not really clear to me what means “drone fly in a certain shape, say in the shape of a star” but l will assume you mean to follow waypoints that will draw the shape of a star if drone follow them.
If I am correct I’ll try to give you a couple of pointers.

You can use PX4 out of the box as firmware that will control your drone. As the first step just make it fly. The next step would be for you to figure out how to control it by sending a mission with QGC. You will notice that you can draw different shapes with it, and PX4 is able to receive different waypoints, store them and then fly them. Next would be to figure out how to send those trajectories over some protocol. I would suggest Mavlink Messages. You can start with this link: