Memory-Aware Optimization of FPGA-based Space Systems