Resolving F-Compiler Error 'Maximum Length of Code Area Reached (64 Kbytes)' in S7 F-Systems

Resolving F-Compiler Error 'Maximum Length of Code Area Reached (64 Kbytes)' in S7 F-Systems

In SIMATIC S7 F-Systems, the compilation error 'Error messages from the SCL compilers during generation of the FC block - E: Maximum length of code area reached (max. 64 Kbytes)' occurs because all fail-safe blocks in a single F-Runtime Group are compiled into one monolithic S7 function (FC). The underlying S7-400 CPU architecture enforces a strict 64 KB code block limit. Because fail-safe blocks generate extensive CRC and diverse redundancy code, packing too many F-blocks into one runtime group exceeds 64 KB. To resolve this, split the fail-safe program into multiple F-Runtime Groups in CFC.

Table of Contents

Architecture of S7-400 64 KB Block Limits and S7 F-Systems Compilation

In SIMATIC S7-400 and S7-400H/F controllers (such as CPU 410-5H 6ES7410-5HX08-0AB0 or CPU 417-4F 6ES7417-4HT14-0AB0), the controller operating system enforces a fundamental architectural constraint:
* Maximum Code Block Size: No single compiled function (FC), function block (FB), or organization block (OB) can exceed 65,536 bytes (64 KB) of machine code.

When programming standard logic in Continuous Function Charts (CFC), the compiler automatically divides standard blocks across multiple runtime groups and functions. However, in S7 F-Systems (6ES7833-1FC02-0YA5), the certified F-Compiler operates under strict TÜV safety rules: all fail-safe blocks assigned to a specific F-Runtime Group are translated into a single consolidated, tamper-proof SCL function (e.g., FC773).

Why Fail-Safe Blocks Generate High Code Volume per Runtime Group

To guarantee SIL 3 / PL e safety integrity without specialized hardware, S7 F-Systems embeds extensive safety mechanisms directly into compiled code:
* Diverse Redundancy: Every mathematical calculation and boolean operation is executed twice using inverted or diverse registers.
* CRC Checksumming: Continuous calculation of Profisafe cyclic redundancy checks (CRCs) across all interconnections.
* Safety Data Flow Verification: Inter-block sequence checking and execution time tracking.

Consequently, a single fail-safe block (such as an analog voter or matrix logic) generates between 5 to 10 times more compiled bytes than an equivalent standard block. If an engineer places dozens of fail-safe channel drivers (F_CH_DI, F_CH_DO, F_CH_AI) and monitoring blocks inside a single F-Runtime group, the generated function rapidly exceeds 64 KB, triggering an unrecoverable compiler abort.

Diagnosing the Overloaded F-Runtime Group in CFC

The following table compares code generation characteristics across PCS 7 block types:

Block ClassificationExample Block InstancesCode Generation MultiplierRuntime Group ConstraintsStandard APL BlocksMotL, VlvL, PIDConL1x (Standard S7 code)CFC compiler splits blocks automatically across FCs.Fail-Safe Channel DriversF_CH_DI (FB346), F_CH_DO (FB347)4x to 6x (Profisafe overhead)Must reside within an F-Runtime Group in cyclic OB35.Fail-Safe Complex LogicF_QU_F, Safety Matrix causes/effects8x to 12x (Diverse redundancy)Rapidly saturates 64 KB limit if grouped together.F-Runtime Group Container@F_ShutDn -> Generates FC773Monolithic compile targetHard limit: Total compiled code < 64 Kbytes.

Table 1: Code generation characteristics in S7 F-Systems.

Step-by-Step Procedure to Split F-Runtime Groups

To resolve the 64 KB limit and successfully compile the safety program:

  1. Open CFC Runtime Editor:
    * In SIMATIC Manager, open any CFC chart.
    * From the top menu, select Options > Customize > Compile/Download or open the Runtime Properties editor (Edit > Run Sequence or press Ctrl + U).
  2. Locate the F-Cyclic Interrupt OB:
    * Navigate to the cyclic interrupt OB assigned to safety (typically OB35 with cycle time e.g., 100 ms).
    * Observe the existing overloaded F-Runtime group (e.g., @F_ShutDn_1).
  3. Create a Secondary F-Runtime Group:
    * In the run sequence tree, right-click OB35 and select Insert F-Runtime Group.
    * Assign a name: @F_ShutDn_2.
    * Configure runtime group properties (execution cycle and safety parameters).
  4. Redistribute Fail-Safe Blocks:
    * Expand the overloaded @F_ShutDn_1 group.
    * Select half of the fail-safe block calls (e.g., move digital output drivers and final shutdown logic into the new group, leaving input drivers in the first group).
    * Drag and drop the selected blocks into @F_ShutDn_2.
  5. Recompile Safety Program:
    * In CFC, execute Chart > Compile > Changes Only (or Entire Program).
    * The F-Compiler generates two separate functions (FC773 and FC774), each comfortably below 40 KB, and successfully generates the safety collective signature.

Verification

To confirm that the 64 KB compilation error is resolved:

  1. Execute Chart > Compile: verify that compilation completes with zero SCL compiler errors.
  2. In the compile log, verify that each generated safety FC reports a code size under 65,536 bytes.
  3. Open Edit > Safety Program: verify that the safety collective signature updates cleanly.
  4. Download the safety program to the S7-400 F-CPU: confirm the controller transitions to RUN mode without triggering an F-STOP or cycle time overrun.

Limitations and Operational Precautions

  • Ensure that execution order between split F-Runtime groups preserves process signal flow: input channel drivers (F_CH_DI) must execute in the first group, logic in the middle, and output drivers (F_CH_DO) in the final group.
  • Do not split blocks that share high-frequency direct feedback loops across different cyclic OBs; keep all interrelated safety groups in the same cyclic interrupt OB (e.g., OB35).
  • Downloading changes to a split safety program requires safety password authorization and re-verification of the collective safety CRC.

Engineer FAQ

Can I increase the 64 KB block limit in CPU hardware properties?

No. The 64 KB block limit is hardcoded into the S7-400 processor architecture (16-bit relative jump instructions); it cannot be increased by firmware or configuration.

How many fail-safe blocks can fit in one F-Runtime group?

As a general engineering rule of thumb, limit each F-Runtime group to approximately 40 to 60 fail-safe blocks depending on complexity.

Does splitting F-Runtime groups increase CPU cycle time?

Splitting runtime groups introduces negligible overhead (a few microseconds for group context switching) while completely eliminating compiler limits.

Technical References

Related Articles

Related Tags

  • S7 F-Systems
  • F-Runtime Group
  • 64 Kbytes Limit
  • SCL Compiler
  • FC773
  • Safety Program
  • PCS 7
6 respuestas