You could approach it from multiple angles. One, get an aerospace degree and focus on writing some software additionally. This approach is good if you would like to get into writing flight software because that requires knowledge of orbital mechanics, aerodynamics, etc.
Two, get a Computer Science degree and apply for an aerospace job. There is so much software work in aerospace that often generalists are also hired. You probably won’t be put directly on writing flight software but there are so many other related things you can work on. For instance, machine learning, simulation, database, APIs, etc are all used and many of the aerospace engineers do not focus on these.
Three, get any other engineering degree and apply for an aerospace job. Aerospace companies hire mechanical, electrical, etc engineers also to write software. These are all systems that need software on a vehicle. Basically, if you have some technical chops and you can write software, go for it.