不能 运行 一个充满数组的大型结构赢得 C

Cannot run a large structure filled with arrays win C

我正在为 Arduino、STM32、AVR 等嵌入式系统构建 SAE J1939

但是我有一个问题我不明白。首先是我编译的时候。没有错误! 但是当我 运行 时,我得到了这个汇编错误。这都是关于 J1939 结构的。

为什么会这样?堆是不是太小了?

Can't find a source file at "C:\mingw810\i686-810-posix-dwarf-rt_v6-rev0\build\gcc-8.1.0\i686-w64-mingw32\libgcc/../../../../../src/gcc-8.1.0/libgcc/config/i386/cygwin.S" Locate the file or edit the source lookup path to include its location.

运行 下面的代码重现错误:

#include <stdio.h>
#include <stdlib.h>
#include "stdint.h"

/* PGN: 0x00E800 - Storing the Acknowledgement from the reading process */
struct Acknowledgement {
    uint8_t control_byte;                           /* This indicates the status of the requested information about PGN: */
    uint8_t group_function_value;                   /* The function code that specify cause of the control byte e.g time out or aborted */
    uint8_t address;                                /* Address from the ECU where the acknowledgement is comming from */
    uint32_t PGN_of_requested_info;                 /* Information request about the PGN */
};

/* PGN: 0x00EC00 - Storing the Transport Protocol Connection Management from the reading process */
struct TP_CM {
    uint8_t control_byte;                           /* What type of message are we going to send */
    uint16_t total_message_size;                    /* Total bytes our complete message includes */
    uint8_t number_of_packages;                     /* How many times we are going to send packages via TP_DT */
    uint32_t PGN_of_the_packeted_message;           /* Our message is going to activate a PGN */
};

/* PGN: 0x00EB00 - Storing the Transport Protocol Data Transfer from the reading process */
struct TP_DT {
    uint8_t sequence_number;                        /* When this sequence number is the same as number_of_packages from TP_CM, then we have our complete message */
    uint8_t data[7][256];                           /* Package data of 2D array where first index is data0 -> data6 and second index is sequence of the data */
};

/* PGN: 0x00EE00 - Storing the Address claimed from the reading process */
struct Name {
    uint32_t identity_number;                       /* Specify the ECU serial ID - 0 to 2097151 */
    uint16_t manufacturer_code;                     /* Specify the ECU manufacturer code - 0 to 2047 */
    uint8_t function_instance;                      /* Specify the ECU function number - 0 to 31 */
    uint8_t ECU_instance;                           /* Specify the ECU number - 0 to 7 */
    uint8_t function;                               /* Specify the ECU function - 0 to 255 */
    uint8_t vehicle_system;                         /* Specify the type of vehicle where ECU is located - 0 to 127 */
    uint8_t arbitrary_address_capable;              /* Specify if the ECU have right to change address if addresses conflicts - 0 to 1 */
    uint8_t industry_group;                         /* Specify the group where this ECU is located - 0 to 7 */
    uint8_t vehicle_system_instance;                /* Specify the vehicle system number - 0 to 15 */
};

/* PGN: 0x00FECA - Storing the DM1 Active diagnostic trouble codes from the reading process */
struct DM1 {
    /* These are SAE lamps can have 1 = ON and 0 = OFF */
    uint8_t SAE_lamp_status_malfunction_indicator;
    uint8_t SAE_lamp_status_red_stop;
    uint8_t SAE_lamp_status_amber_warning;
    uint8_t SAE_lamp_status_protect_lamp;
    uint8_t SAE_flash_lamp_malfunction_indicator;
    uint8_t SAE_flash_lamp_red_stop;
    uint8_t SAE_flash_lamp_amber_warning;
    uint8_t SAE_flash_lamp_protect_lamp;

    /* Fault location, problem and codes */
    uint32_t SPN;                                   /* Location where the fault exist */
    uint8_t FMI;                                    /* Type of problem */
    uint8_t SPN_conversion_method;                  /* If SPN_conversion_method = 1 that means Diagnostics Trouble Code are aligned using a newer conversion method. If SPN_conversion_method = 0 means one of the three Diagnostics Trouble Code conversion methods is used and ECU manufacture shall know which of the three methods is used */
    uint8_t occurence_count;                        /* This tells how many times failure has occurred. Every time fault goes from inactive to active, the occurence_count is incremented by 1. If fault becomes active for more than 126 times the occurence_count remains 126 */
};

/* PGN: 0x00D800 - Storing the DM15 response from the reading process */
struct DM15 {
    uint16_t number_of_allowed_bytes;               /* How many bytes we are allowed to write or read to */
    uint8_t status;                                 /* Status of the response */
    uint32_t EDC_parameter;                         /* Status code */
    uint8_t EDCP_extention;                         /* Describe how we should interpret the EDC parameter as a status code or error code */
    uint16_t seed;                                  /* Response of the key if we need more key or no key at all */
};

/* PGN: 0x00D700 - Storing the DM16 binary data transfer from the reading process */
struct DM16 {
    uint8_t number_of_occurences;                   /* How many bytes we have sent */
    uint8_t raw_binary_data[256];                   /* Here we store the bytes */
};

/* Storing the error codes from the reading process */
struct DM {
    uint8_t errors_dm1_active;                      /* How many errors of DM1 we have right now */
    uint8_t errors_dm2_active;                      /* How many errors of DM2 is active */
    struct DM1 dm1[256];                            /* dm1 can contains multiple error messages */
    struct DM1 dm2[256];                            /* dm2 contains previously active errors from dm1 */
    struct DM15 dm15;                               /* dm15 is the memory access response from DM14 memory request */
    struct DM16 dm16;                               /* dm16 is the binary data transfer after DM15 memory response (if it was proceeded) */
    /* Add more DM here */
};

/* PGN: 0x00FEDA - Storing the software identification from the reading process */
struct Software_identification {
    uint8_t length_of_each_identification;          /* The length of each identification - Not part of J1939 standard */
    uint8_t number_of_fields;                       /* How many numbers contains in the identifications array */
    uint8_t identifications[256];                   /* This can be for example ASCII */
};

/* PGN: 0x00FDC5 - Storing the ECU identification from the reading process */
struct ECU_identification {
    uint8_t length_of_each_field;                   /* The real length of the fields - Not part of J1939 standard */
    uint8_t ecu_part_number[256];                   /* ASCII field */
    uint8_t ecu_serial_number[256];                 /* ASCII field */
    uint8_t ecu_location[256];                      /* ASCII field */
    uint8_t ecu_type[256];                          /* ASCII field */
    uint8_t ecu_manufacturer[256];                  /* ASCII field */
    uint8_t ecu_hardware_version[256];              /* ASCII field */
};

/* PGN: 0x00FEEB - Storing the component identification from the reading process */
struct Component_identification {
    uint8_t length_of_each_field;                   /* The real length of the fields - Not part of J1939 standard */
    uint8_t component_product_date[256];            /* ASCII field */
    uint8_t component_model_name[256];              /* ASCII field */
    uint8_t component_serial_number[256];           /* ASCII field */
    uint8_t component_unit_name[256];               /* ASCII field */
};

/* PGN: 0x00FE30 (65072) to 0x00FE3F (65087) */
struct Auxiliary_valve_command {
    uint8_t standard_flow;                          /* Command flow */
    uint8_t fail_safe_mode;                         /* If the user want the valve to go to neutral */
    uint8_t valve_state;                            /* Retract, Extend, Neutral, Init, Error etc */
};

/* PGN: 0x00FE10 (65040) to 0x00FE1F (65055) */
struct Auxiliary_valve_estimated_flow {
    uint8_t extend_estimated_flow_standard;         /* A measurement */
    uint8_t retract_estimated_flow_standard;        /* A measurement */
    uint8_t valve_state;                            /* Retract, Extend, Neutral, Init, Error etc */
    uint8_t fail_safe_mode;                         /* The mode if we are going to use fail safe mode or not */
    uint8_t limit;                                  /* Enter a limit code */
};

/* PGN: 0x00C400 (50176) */
struct General_purpose_valve_command {
    uint8_t standard_flow;                          /* Command flow */
    uint8_t fail_safe_mode;                         /* If the user want the valve to go to neutral */
    uint8_t valve_state;                            /* Retract, Extend, Neutral, Init, Error etc */
    uint16_t extended_flow;                         /* Another command flow */
};

/* PGN: 0x00C600 (50688) */
struct General_purpose_valve_estimated_flow {
    uint8_t extend_estimated_flow_standard;         /* A measurement */
    uint8_t retract_estimated_flow_standard;        /* A measurement */
    uint8_t valve_state;                            /* Retract, Extend, Neutral, Init, Error etc */
    uint8_t fail_safe_mode;                         /* The mode if we are going to use fail safe mode or not */
    uint8_t limit;                                  /* Enter a limit code */
    uint16_t extend_estimated_flow_extended;        /* A measurement */
    uint16_t retract_estimated_flow_extended;       /* A measurement */
};

struct Auxiliary_valve_measured_position {
    uint16_t measured_position_procent;             /* Procent position */
    uint8_t valve_state;                            /* Retract, Extend, Neutral, Init, Error etc */
    uint16_t measured_position_micrometer;          /* Micrometer position */
};

typedef struct {
    /* For information about other ECU */
    uint8_t number_of_ECU;
    uint8_t number_of_cannot_claim_address;
    uint8_t ECU_address[256];
    struct Acknowledgement acknowledgement[256];
    struct TP_CM tp_cm[256];
    struct TP_DT tp_dt[256];
    struct Name name[256];
    struct DM dm[256];
    struct Software_identification software_identification[256];
    struct ECU_identification ecu_identification[256];
    struct Component_identification component_identification[256];
    struct Auxiliary_valve_estimated_flow auxiliary_valve_estimated_flow[256][16];
    struct General_purpose_valve_estimated_flow general_purpose_valve_estimated_flow[256];
    struct Auxiliary_valve_measured_position auxiliary_valve_measured_position[256][16];

    /* For information about this ECU */
    struct Name this_name;
    uint8_t this_ECU_address;
    struct DM this_dm;
    struct Software_identification this_software_identification;
    struct ECU_identification this_ecu_identification;
    struct Component_identification this_component_identification;
    struct Auxiliary_valve_command this_auxiliary_valve_command[16];
    struct General_purpose_valve_command this_general_purpose_valve_command;


} J1939;

int main(void) {

    J1939 j1939;
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    return EXIT_SUCCESS;
}

此信息不是编译错误。您执行调试器并尝试调试没有定位源的程序的一部分。如果您的程序在已编译的库中停止,则可能会发生这种情况。那么我们只能使用汇编指令。如上所述,尝试在您的 main() 函数中设置断点。