Marshaller Memory Footprint Analysis

Table of Content


Conditions

  • Codesourcery GCC 4.5.2
  • Compile Flags: '-ffunction-sections', '-fdata-sections', '-mlong-calls', '-mapcs', '-mthumb-interwork', '-fshort-enums', '-fno-common', '-mcpu=arm966e-s', '-Os', '-mthumb'
  • rcX V2.1.5.0
  • Marshaller V2.0.16.1
  • netX51
  • USB Serial Marshalling (USB_MARSHALLER)
  • Packet Transport (PACKET_MARSHALLER)

Static Code & Data

ComponentCode Size [Bytes]Data Size [Bytes]
Marshaller Core
2882184
Packet Transport190454
Serial Connector86052
rcX Uart Driver2640224
Total8286514



Marshaller Footprint of target firmware may differ slightly from calculation above, as shared kernel componts (e.g. Semaphore) are explicitly not considered!



 Details: Marshaller Core
.text.CalculateCRC16 0x4c 
.text.FindTransportLayer 0x22
.text.OS_LOCK  0x10
.text.OS_UNLOCK.clone.0 0xc 
.text.HilMarshallerFreeBuffer 0x5c
.text.ResetRxStateMachine 0x28
.text.HilMarshallerGetBuffer 0x64
.text.HilMarshallerStop 0x70
.text.HilMarshallerStart 0x10c
.text.HilMarshallerRegisterConnector 0x164
.text.HilMarshallerUnregisterConnector 0x94
.text.HilMarshallerConnTxData 0x34 
.text.SendAcknowledge 0x58
.text.HilMarshallerConnRxData 0x3d0
.text.HilMarshallerConnTxComplete 0x10
.text.HilMarshallerRegisterTransport 0x58 
.text.HilMarshallerUnregisterTransport 0x1c 
.text.HilMarshallerTimer 0x64 
.text.HilMarshallerMain 0x80 
.text.MarshallerRequestCallback 0x14
.text.MarshallerTestTask 0x84
.bss.s_abSemaphore 0x34
.bss.s_abTimer 0x50
.data.s_tMarshallerParams 0x34
 Details: Packet Transport
.text.rcXPacketReady 0x10
.text.PacketTransportDeinit 0xac 
.text.PacketTransportHandler 0x118 
.text.PacketTransportThread 0x224
.text.PacketTransportInit 0x270
.text.TlrRouter_PacketReceived 0xd0
.text.TlrRouter_PacketSendable 0x38
.rodata.str1.1 0x16
.data.s_tPacketTransportCfg 0x18
.data.s_atMarshallerTransportParams 0x8
 Details: Serial Connector
.text.UartConnectorPoll 0xa 
.text.UartConnectorError 0x2
.text.UartConnectorTxEmpty 0xb0
.text.UartConnectorSend 0x60
.text.UartConnectorRxReady 0x64
.text.UartConnectorDeinit 0x40
.text.UartConnectorActivate 0x38
.text.UartConnectorInit 0x164
.data.s_tUsbUartConfig 0x14
.data.s_atMarshallerConnectorParams 0x20
 Details: rcX Uart Driver
.text.HalUartMode 0x30
.text.HalUartReset 0x4
.text.HalUartCharacterReceived 0x38
.text.HalUartChannelIrq 0x3c
.text.HalUartChannelPoll 0x34
.text.HalUartChangeRts 0x2c
.text.HalUartGetStatus 0x3c
.text.USBReset 0x38
.text.USBDeliverRxData 0x38
.text.HalCdcDelete 0x10
.text.HalCdcEnable 0x20
.text.HalCdcMode 0x18
.text.HalCdcEnableReceiver 0x30
.text.HalCdcEnableTransmitter 0x20
.text.HalCdcReceive 0x38
.text.HalCdcSend 0x38
.text.HalCdcReset 0x4
.text.HalCdcPollFunc 0x28
.text.HalCdcIsrFunc 0x10
.text.HalCdcGetStatus 0x8
.text.HalCdcChangeRts 0x8
.text.HalUartSend 0x70
.text.HalUartReceive 0x94
.text.HalUartEnableTransmitter 0x38
.text.HalUartEnableReceiver 0x38
.text.HalUartEnable 0x3c
.text.HalUartDelete 0x34
.text.HalUartInitialize 0x1bc
.text.SetupStringDescriptor 0x40
.text.HalCdcInitialize 0xac
.text.Drv_UrtCreateUart 0xec
.text.DrvUrtInit 0x5c
.text.Drv_UrtInitializeUart 0x68
.text.Drv_UrtIdentifyUart 0x2c
.text.Drv_UrtDisableUart 0x28
.text.Drv_UrtEnableUart 0x28
.text.Drv_UrtEnableReceiver 0x24
.text.Drv_UrtEnableTransmitter 0x24
.text.Drv_UrtRecv 0x24
.text.Drv_UrtSend 0x24
.rodata.s_tUartFncTbl 0x34
.rodata.s_tCdcFncTbl 0x34
.rodata.atrXUrt 0x78

Dynamic Memory Allocation

The attributes listed below are configurable by target firmware and have considerable influence on dynamic memory foorprint!


AttributeComment

Marshaller Core

RX_STATIC_TASK_T:StckSizMaximum Stack Requirement = 452 Bytes
Packet TransportPACKET_TRANSPORT_CONFIG_T:ulMaxChannelsNumber of channels handled by Marshaller (system channel, protocol 1, protocol 2, etc.)
PACKET_TRANSPORT_CONFIG_T:ulStackSizeMaximum Stack Requirement = 232 Bytes
Serial Connector

HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferCnt

Limits the number of parallel services
HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferSize

Should match the size of the largest expected telegram plus additional 20 bytes for marshaller transport header.

e.g: 20 + 1596 (TLR_MAX_PACKET_SIZE) = 1616 Bytes

HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulTxBufferCntCan be 0 if unsolicited packets and indications should not be processed
HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulTxBufferSize

TX Buffer size for unsolicited packets / calls (indication / callbacks)

Can be 0 if unsolicited packets and indications should not be processed

rcX Uart DriverRX_INTERRUPT_SET:ulTaskStackSizeMaximum Stack Requirement = 284 Bytes



Maximum stack space was evaluated during runtime via pattern search method for a specific target configuration and a restricted use case scenario. Those values may differ for other target configurations or extended use cases!


Full dynamic memory requirement for each component is given in the table below.

ComponentDynamic Allocation Size [Bytes]Minimum Requirement [Bytes]
Marshaller Core

384 +

(RX_STATIC_TASK_T:StckSiz * 4)

836
Packet Transport

500 + 

(PACKET_TRANSPORT_CONFIG_T:ulMaxChannels * 120) +

(PACKET_TRANSPORT_CONFIG_T:ulStackSize * 4)

972
Serial Connector

624 +

(HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferCnt * (HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferSize + 104)) +

(HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulTxBufferCnt * (HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulTxBufferSize + 104))

2344
rcX Uart Driver

176 +

RX_INTERRUPT_SET:ulTaskStackSize * 4

460
Total

1684 + [Configureable]

4612



 Heap analyser results of a specific target firmware

Firmware sources:

http://subversion01:8080/svn/EmbeddedOS/Marshaller/Device/rcX/latest/targets/TestApp

Settings:

  • RX_STATIC_TASK_T:StckSiz = 128
  • PACKET_TRANSPORT_CONFIG_T:ulMaxChannels = 4
  • PACKET_TRANSPORT_CONFIG_T:ulStackSize = 64
  • HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferCnt = 1
  • HIL_MARSHALLER_CONNECTOR_PARAMS_T:ulDataBufferSize = 1616
  • RX_INTERRUPT_SET:ulTaskStackSize = 80

Stack Coverage

Heap Analysis

Total Heap requirement = 4972 Bytes