A method of dynamic sharing of RAM in a software-defined communication system, comprising: (a) storing program code in a flash memory of the software-defined communication system; (b) categorizing a plurality of parts of the program code into a group of transmission categories according to when program code of each of a first group of the parts of the program code needs to be copied into a first part of a RAM and then executed during a first state of a transmission,TX, state machine, and also according to how each of a second group of parts of the program code can be later fit into the first part of the RAM and then executed during another state which may be another state of the TX state machine or a state of a RX state machine, and also categorizing a plurality of parts of the program code into a group of receive categories according to when program code of each of a third group of the parts of the program code needs to be copied into a second part of the RAM and then executed during a first state of the RX state machine and also according to how each of a fourth group of parts of the program code can be later fit into the second part of the RAM and then executed during another state which may be another state of the RX state machine or another state of the TX state machine; (c) copying the code of at least one category in the group of transmission categories from the flash memory into the RAM in accordance with the categorizing, and copying the code of at least one category in the group of receive categories from the flash memory into the RAM in accordance with the categorizing; (d) executing the TX state machine during a transmission time interval to perform first predetermined operations on program code then in the RAM to prepare transmission data to be transmitted; and (e) executing the RX state machine during a receive time interval to perform second predetermined operations on program code then in the RAM to process data received. (a) storing program code in a flash memory of the software-defined communication system; (b) categorizing a plurality of parts of the program code into a group of transmission categories according to when program code of each of a first group of the parts of the program code needs to be copied into a first part of a RAM and then executed during a first state of a transmission,TX, state machine, and also according to how each of a second group of parts of the program code can be later fit into the first part of the RAM and then executed during another state which may be another state of the TX state machine or a state of a RX state machine, and also categorizing a plurality of parts of the program code into a group of receive categories according to when program code of each of a third group of the parts of the program code needs to be copied into a second part of the RAM and then executed during a first state of the RX state machine and also according to how each of a fourth group of parts of the program code can be later fit into the second part of the RAM and then executed during another state which may be another state of the RX state machine or another state of the TX state machine; (c) copying the code of at least one category in the group of transmission categories from the flash memory into the RAM in accordance with the categorizing, and copying the code of at least one category in the group of receive categories from the flash memory into the RAM in accordance with the categorizing; (d) executing the TX state machine during a transmission time interval to perform first predetermined operations on program code then in the RAM to prepare transmission data to be transmitted; and (e) executing the RX state machine during a receive time interval to perform second predetermined operations on program code then in the RAM to process data received. <EOS>