Optimising Security, Power Consumption and Performance of Embedded Systems