Atmel Studio:行尾出现垃圾错误

Posted

技术标签:

【中文标题】Atmel Studio:行尾出现垃圾错误【英文标题】:Atmel Studio: garbage at end of line error 【发布时间】:2012-12-02 18:51:18 【问题描述】:

我正在尝试使用来自的 ATMEL CAN 库编译一个程序以在 AT90CAN128 上运行 http://www.atmel.com/tools/CANSOFTWARELIBRARY.aspx

但是,当我尝试编译时,Atmel Studio 6 中出现以下错误

# |说明 |文件 |行 |科尔 1 |缺少')' | -\Temp\ccMKhrlO.s | 89 | 1 2 |垃圾在行尾| -\Temp\ccMKhrlO.s | 89 | 1

我假设这些是编译器生成的内部程序集文件,但是当我导航到指定的位置时该文件不存在。

有没有人遇到过类似的问题,可能知道这里发生了什么?

编译日志相关部分如下:

------ Build started: Project: FSAE Steering, Configuration: Debug AVR ------
...
...
Building file: ../libraries/lib_mcu/flash/flash_appli_lib.c
I"C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DF_CPU=1600000UL  -I".." -I"../libraries/lib_module" -I"../libraries/lib_module/isp" -I"../libraries/lib_mcu" -I"../libraries/lib_mcu/adc" -I"../libraries/lib_mcu/can" -I"../libraries/lib_mcu/eeprom" -I"../libraries/lib_mcu/flash" -I"../libraries/lib_mcu/spi" -I"../libraries/lib_mcu/timer" -I"../libraries/lib_mcu/uart" -I"../libraries/lib_board/audio" -I"../libraries/lib_board/key" -I"../libraries/lib_board/led" -I"../libraries/lib_board/rtc" -I"../libraries/lib_board/sensor" -I"../libraries/lib_board"  -O1 -fpack-struct -fshort-enums -g2 -Wall -c -std=gnu99 -MD -MP -MF "libraries/lib_mcu/flash/flash_appli_lib.d" -MT"libraries/lib_mcu/flash/flash_appli_lib.d" -MT"libraries/lib_mcu/flash/flash_appli_lib.o"  -mmcu=at90can128   -o"libraries/lib_mcu/flash/flash_appli_lib.o" "../libraries/lib_mcu/flash/flash_appli_lib.c" 

C:\Users\Dan\AppData\Local\Temp\ccMKhrlO.s: Assembler messages:
C:\Users\Dan\AppData\Local\Temp\ccMKhrlO.s(89,1): missing ')'
C:\Users\Dan\AppData\Local\Temp\ccMKhrlO.s(89,1): garbage at end of line
make: *** [libraries/lib_mcu/flash/flash_appli_lib.o] Error 1
Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "FSAE Steering.cproj" -- FAILED.
Done building project "FSAE Steering.cproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

看起来它正在不正确地将 flash_appli_lib.c 转换为程序集。但是查看文件并没有发现明显的问题。

flash_appli_lib.c

//******************************************************************************
//! @file $RCSfile: flash_appli_lib.c,v $
//!
//! Copyright (c) 2007 Atmel.
//!
//! Use of this program is subject to Atmel's End User License Agreement.
//! Please read file license.txt for copyright notice.
//!
//! @brief This file contains the library of functions of:
//!             - Flash (code in "Application Flash Section")
//!             - for AT90CAN128/64/32.
//!
//! This file can be parsed by Doxygen for automatic documentation generation.
//! This file has been validated with AVRStudio-413528/WinAVR-20070122.
//!
//! @version $Revision: 3.20 $ $Name: jtellier $
//!
//! @todo
//! @bug
//******************************************************************************

//_____ I N C L U D E S ________________________________________________________
#include "config.h"
#include "flash_appli_lib.h"
#include "flash_appli_drv.h"

//_____ D E F I N I T I O N S __________________________________________________

//_____ F U N C T I O N S ______________________________________________________

//------------------------------------------------------------------------------
//  @fn flash_rd_byte
//!
//! This function allows to read a byte in 64K bytes of Flash memory.
//!
//! @warning: _RAMPZ_IS_USED must be defined in "config.h"
//! @warning: The 64K page setting must be done before (ex: setting
//!           or clearing the RAMPZ register).
//!
//! @param: addr_byte   Address to read the byte in Flash memory.
//!
//! @return:    Value read in the Flash memory.
//!
//------------------------------------------------------------------------------
U8 flash_rd_byte(U16 addr_byte)

#if defined(_RAMPZ_IS_USED_)
    U32  far_addr_byte;

    far_addr_byte = (((U32)(RAMPZ))<<16) | ((U32)(addr_byte));
    return (Farflash_rd_byte(far_addr_byte));

#else
    return (Stdflash_rd_byte(addr_byte));

#endif   //- If _RAMPZ_IS_USED_ ...

//    return (Flash_rd_byte(addr_word));


//------------------------------------------------------------------------------
//  @fn flash_rd_word
//!
//! This function allows to read a word in 64K bytes of Flash memory.
//!
//! @warning: _RAMPZ_IS_USED must be defined in "config.h"
//! @warning: 1 - The address of the word is an even byte address.
//!           2 - The 64K page setting must be done before (ex: setting
//!               or clearing the RAMPZ register).
//!
//! @param: addr_word   Address to read the word in Flash memory.
//!
//! @return:    Value read in the Flash memory.
//!
//------------------------------------------------------------------------------
U16 flash_rd_word(U16 addr_word)

#if defined(_RAMPZ_IS_USED_)
    U32  far_addr_word;

    far_addr_word = (((U32)(RAMPZ))<<16) | ((U32)(addr_word));
    return (Farflash_rd_word(far_addr_word));

#else
    return (Stdflash_rd_word(addr_word));

#endif   //- If _RAMPZ_IS_USED_ ...

//    return (Flash_rd_word(addr_word));


//------------------------------------------------------------------------------
//  @fn flash_appli_wr_byte
//!
//! This function allows to write a byte in 64K bytes of Flash memory.
//!
//! @warning: The 64K page setting must be done before (ex: setting
//!           or clearing the RAMPZ register).
//!
//! @param: addr_byte   Address to write the byte in Flash memory.
//!         value       Value to write in the Flash memory.
//!
//! @return none
//!
//------------------------------------------------------------------------------
void flash_appli_wr_byte(U16 addr_byte, U8 value)

    flash_appli_wr_block(&value, addr_byte, 1);


//------------------------------------------------------------------------------
//  @fn flash_appli_wr_block
//!
//! This application function calls flash_wr_block() function of the BootLoader
//!    if the application is runnning supervised by the BootLoader developped
//!    by ATMEL (see "can_bootloader_example" or "can_uart_bootloader_example").
//!
//! @warning: The 64K page setting must be done before (ex: setting
//!           or clearing the RAMPZ register).
//! @warning: See flash_wr_block() function in "flash_boot_lib.c".
//!
//! @param: - src      Source of (SRAM) buffer Address.
//!         - dest     Destination, start address in Flash memory where data
//!                    must be written.
//!         - byte_nb  Number of byte to write.
//!
//! @return none
//!
//------------------------------------------------------------------------------
void flash_appli_wr_block(U8* src, U16 dest, U16 byte_nb)

    Call_flash_appli_wr_block();

【问题讨论】:

【参考方案1】:

我通过从项目中删除有问题的 c 文件来修复错误。 似乎 Atmel 工作室正在尝试编译所有内容,而不仅仅是从 main 链接的内容。

【讨论】:

以上是关于Atmel Studio:行尾出现垃圾错误的主要内容,如果未能解决你的问题,请参考以下文章

Atmel Studio 7-静态库未定义函数参考

将项目从 ICCAVR 移植到 Atmel Studio 7.0 _flash 问题

Atmel studio 不工作用于发布或调试模式选择的工具窗口

两个整数相乘给出错误值(ATMEL ATmega32A)

Atmel Studio 7 如何编译和调试 Arduino 代码?

教科书示例中的可疑错误 - Atmel Assembly