Skip to content

Compiler.java: adds options to support -W,-Wall flags, .map file and .lst file generation, avr-size output #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

jcwren
Copy link

@jcwren jcwren commented Dec 21, 2010

This patch adds 4 preferences.txt options to support enabling -W and -Wall
flags when compiling, producing a .map file as part of the linking stage,
producing a diassembly list file after linking, and a more verbose size output.

Adding 'compiler.show_all_warnings=true' to preferences.txt adds the -W and
-Wall flags passed to the compiler, and removes the -w flag. This produces
informative verbose warnings about less than ideally constructed code, such as
signed vs unsigned comparisons, unused variables, and a great deal of other
useful information.

Adding 'compiler.map_file=true' causes the linker to produce a detailed map
file listing of the code. This file is written to the directory the sketch is
located in.

Adding 'compiler.lst_file=true' causes avr-objdump to be run on the produced
.elf file. The listing file contains a disassembled listing of the code
intermixed with the source code. The -d (Display assembler contents of
executable sections) and -S (Intermix source code with disassembly) options are
passed to avr-objdump. The resulting .lst file is written to the directory the
sketch is located in.

Adding 'compiler.detailed_size' causes avr-size to be run on the produced .elf
file. This displays a more detailed report the combined sizes of the program
space (.text + .data + .bootloader), and the combined sizes of data space
(.data + .bss + .noinit)

Unfortunately, avr-objdump does not support a command line option to specify
where to write the output of the program to. Instead, EVERYTHING goes to
stdout. Normally anything written to stdout by an exec'ed program is written
to the status window of the Arduino IDE. To get the the stdout of avr-objdump
captured to be written to an output file required a tad bit hackishness in the
execAsynchronously function. See source for details.

….lst file generation, avr-size output

This patch adds 4 preferences.txt options to support enabling -W and -Wall
flags when compiling, producing a .map file as part of the linking stage,
producing a diassembly list file after linking, and a more verbose size output.

Adding 'compiler.show_all_warnings=true' to preferences.txt adds the -W and
-Wall flags passed to the compiler, and removes the -w flag.  This produces
informative verbose warnings about less than ideally constructed code, such as
signed vs unsigned comparisons, unused variables, and a great deal of other
useful information.

Adding 'compiler.map_file=true' causes the linker to produce a detailed map
file listing of the code.  This file is written to the directory the sketch is
located in.

Adding 'compiler.lst_file=true' causes avr-objdump to be run on the produced
.elf file.  The listing file contains a disassembled listing of the code
intermixed with the source code.  The -d (Display assembler contents of
executable sections) and -S (Intermix source code with disassembly) options are
passed to avr-objdump.  The resulting .lst file is written to the directory the
sketch is located in.

Adding 'compiler.detailed_size' causes avr-size to be run on the produced .elf
file.   This displays a more detailed report the combined sizes of the program
space (.text + .data + .bootloader), and the combined sizes of data space
(.data + .bss + .noinit)

Unfortunately, avr-objdump does not support a command line option to specify
where to write the output of the program to.  Instead, EVERYTHING goes to
stdout.  Normally anything written to stdout by an exec'ed program is written
to the status window of the Arduino IDE.  To get the the stdout of avr-objdump
captured to be written to an output file required a tad bit hackishness in the
execAsynchronously function.  See source for details.
Print currently uses a signed vs unsigned comparison in Print::print(const String &s) while iterating through individual characters.
This causes compiler warnings when using -W -Wall.
The static keyword is improperly placed in the declaration of the intFunc
variable.
Compiling with -W -Wall flags revealed that the 'base' variable in the
parameter list for String::String( const long value, const int base )
was not being passed to the ultoa() function.  Instead, the parameter
to ultoa() was hard-coded to 10.
The length() function has a useless 'const' keyword in the declation, causing
the compiler to throw a "type qualifiers ignored on function return type"
warning when compiled with -W -Wall.
This patch fixes the "initialization makes integer from pointer without a cast"
warning generated by the compiler when using the -W -Wall flags.  The data type
in the array is a uint16_t, but DDRA (for example) is a pointer.  A cast is
required to make GCC happy.
The SPI pins are declared as 'const static' instead of 'static const', causing
the compiler to throw a warning with the -W -Wall flags are used.
When compiling with the -W -Wall flags, a warning is emitted indicating that
<avr/delay.h> has been moved to <util/delay.h>.  This patch fixes the #include
to point to the new location.
aguegu added a commit to aguegu/Arduino that referenced this pull request Oct 1, 2012
tbowmo pushed a commit to tbowmo/Arduino that referenced this pull request Jul 14, 2016
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant