Skip to content

Latest commit

 

History

History
383 lines (303 loc) · 17.5 KB

File metadata and controls

383 lines (303 loc) · 17.5 KB

Changes in AVR-LibC v2.3.1

This is a quick followup on v2.3.0 with regression fixes.

Regressions fixed

  • #1060 adds a reference to main in crt<mcu>.o. It fixes an undefined reference to main error from the linker when main is implemented in an archive, like in Arduino.

  • A patch introduced a syntax error #1061 in util/setbaud.h. The patch has been reverted.

Changes in AVR-LibC v2.3.0

General

ABI and API Changes

  • Parts of the startup code are now optional and have been moved from crt<mcu>.o to the device support library lib<mcu>.a.
    When specific parts of the startup code are not wanted, a respective symbol can be defined so that the associated code is no more pulled in:
    • Define __init_sp to skip the setting of SP in .init2 (#1011).
    • Define __call_main to skip calling main and exit in .init9 (#1012).
      main must be executed by other means, e.g. by putting it in section .init9 which is supported by -mno-call-main since GCC v15.
    • Define __init_cvt to skip setting CPUINT_CTRLA.CPUINT_CVT in .init3 (#1010).
      This is only relevant when a Compact Vector Table is in effect, for example my means of -mcvt as supported since GCC v15.

Improvements and Additions

  • Support has been added for: ATxmega16E5, ATA5791, ATA8210, ATA8510 (#876), ATA5835, ATA5787, ATA5700M322, ATtiny416auto, AVR32DA28S, AVR32DA32S, AVR32DA48S, AVR64DA28S, AVR64DA32S, AVR64DA48S AVR64DA64S, AVR128DA28S, AVR128DA32S, AVR128DA48S, AVR128DA64S, AVR16DU14, AVR16DU20, AVR16DU28, AVR16DU32, AVR32DU14, AVR32DU20, AVR32DU28, AVR32DU32, AVR32EB14, AVR32EB20, AVR32EB28, AVR32EB32, AVR16LA14, AVR16LA20, AVR16LA28, AVR16LA32, AVR32LA14, AVR32LA20, AVR32LA28, AVR32LA32, AVR32SD20, AVR32SD28, AVR32SD32.

  • Support has been added for the stpcpy, stpcpy_P, stpcpy_F, stpcpy_PF, stpcpy_FX functions (#1015).

  • Support for the strtoll and strtoull functions has been added to <stdlib.h>. The strtol and strtoul functions have been rewritten to increase performance.

  • The strtod, strtold, atof and atofl functions have been implemented to support IEEE double, i.e. they work with -mdouble=64.

  • Support for some non-standard functions has been added to <stdlib.h>:

    • 64-bit integer to ASCII conversions: lltoa, ulltoa, ulltoa_base10.
    • 16-bit integer square root: sqrtu16_floor.
    • 32-bit integer square root: sqrtu32_floor.
    • 64-bit integer square root: sqrtu64_floor (#1058).
  • Support has been added for some functions on Reduced Tiny (AVRrc): _PROTECTED_WRITE_SPM and ccp_write_spm (ATtiny102/104 only), _PROTECTED_WRITE and ccp_write_io (#1053), memmem, memmem_P, strlcpy, strlcpy_P, strcasestr, strcasestr_P, strspn, strspn_P, strcspn, strcspn_P, strlcat_P, strsep, strsep_P, strpbrk_P, strtok_rP, ltoa, ultoa.

  • Documentation for the <stdfix.h> header for ISO/IEC TR 18037 fixed-point support has been added.

  • Support has been added for the fixed-point arithmetic functions rdivi, urdivi, lrdivi, ulrdivi (#999), sqrthr, sqrtuhr (#1024), , sqrtr, sqrtur, sqrtlr, sqrtulr (#1058), sqrtk, sqrtuk, sqrthk, sqrtuhk, atank, atanuk, atanur, acosk, acosuk, asink, asinuk, log2uhk, log2uk, log21puhr, log21pur, exp2k, exp2uk, exp2m1ur, sinpi2k, sinuhk_deg, sinpi2ur, cospi2k, cosuhk_deg.

  • Support has been added to <stdfix.h> for functions reading fixed-point values from program space like pgm_read_* and pgm_read_*_far, where * stands for the fixed-point constant suffix.

  • Support has been added to <stdfix.h> for functions accessing the EEPROM like eeprom_read_*, eeprom_write_* and eeprom_update_*, where * stands for the fixed-point constant suffix.

  • Support has been added for fixed-point to decimal ASCII conversions: ktoa, uktoa, hktoa, uhktoa, rtoa, urtoa, hrtoa, uhrtoa.

  • Support for llabs has been added to <stdlib.h>.

  • Support a new header <avr/flash.h> for better support of avr-gcc's named address spaces __flash and __flashx. For example, it provides functions like strcpy_F and strcpy_FX that work the same like strcpy_P and strcpy_PF from <avr/pgmspace.h>, but use proper address-space qualifiers.

  • Support for Compact Vector Tables has been added as #1010. It is provided by crt<mcu>-cvt.o. One way to use that variant of the startup code is by means of avr-gcc -mcvt which is supported since GCC v15.

  • Support the ISR_N macro in <avr/interrupt.h>. This allows to specify the IRQ number as an argument to the signal attribute, which is supported since GCC v15 PR116056. It allows to use static functions or functions defined in a C++ namespace as an ISR. It also allows to define ISR aliases without the penalty of an additional JMP/RJMP instruction (#765).

  • Support for a new non-standard header <util/ram-usage.h> has been added. It can be used to get estimates of how much stack is used by a running program.

  • The uint24_t, int24_t and associated types and macros have been added to <stdint.h> (#1045).

  • EEPROM routines to access signed and unsigned integer types have been added to <avr/eeprom.h> for: char, uint8_t, int8_t, uint16_t, int16_t, uint24_t, int24_t, uint32_t, int32_t, uint64_t, int64_t.

  • The C/C++ register footprint of some common simple functions has been improved by implementing them as extern inline assembly stubs: strlen, strlen_P, strcpy, strcpy_P, strcmp, strcmp_P, memcpy_P, strchr, strchr_P (#1013), and the functions from <ctype.h>.

  • rand and rand_r now use a less resource-hungry algorithm. The runtime is less than 1/8 compared to the previous algorithm, and the code size is less than 1/4 while maintaining reasonable pseudo-randomness. The old implementation of rand was basically like random() & 0x7fff, so that you can return to the old algorithm if desired.

  • common/asmdef.h used a sub-optimal definition of XJMP and XCALL (#993). Outcome was a sub-optimal code generation for some devices like the ones in avrxmega3/short-calls.

  • Support for the floating-point functions log2, log2f, log2l (#1032) and sincosf has been added to <math.h>.

  • The error of asinf has been improved from 8 ULPs to 3 ULPs.

  • The error of logf has been improved from 5 ULPs to 3 ULPs.

  • assert doesn't use fprintf anymore, but a custom, light-weight function instead in order to diagnose a failed assertion.

  • strftime doesn't use sprintf anymore. The code size of strftime (including all dependencies) has been reduced by more than the code size of sprintf. Support has been added for the %k, %l and %P formats. String literals have been moved to .progmemx.

  • The benchmark page has been reworked. It includes now fixed-point and IEEE double floating-point benchmarks. The IEEE single floating-point benchmarks now include the code sizes, precision data, average execution times, and (lower bounds for the) worst case execution times.

  • Apart from -Wl,-u,vfprintf -lprintf_flt there is now the alternative -Wl,--defsym,vfprintf=vfprintf_flt which doesn't link the printf code when the application doesn't use printf, and when linked with -Wl,--gc-sections. Similar applies to the minimal variants and to the scanf functions like -Wl,--defsym,vfscanf=vfscanf_min. See vfprintf and #654.

  • With -mdouble=64, functions from the printf family now perform floating-point conversions instead of just printing a ?. The value is converted to IEEE single for conversion.

  • Added configure option --with-doxygen= to select the Doxygen executable for generating the documentation.

  • Added configure option --with-man-page= to chose the page for the man pages. The default is 3avr. Previous versions of AVR-LibC used the hard-coded page of 3 (#1051).

Issues closed

  • See also the list of issues closed for v2.3.

  • Since v2.2.0 (#936), gcrt1.S defines symbols __DATA_REGION_ORIGIN__ and __DATA_REGION_LENGTH__ to allow for more precise diagnostics from the linker when the data region overflows. However, letting .data start at __DATA_REGION_ORIGIN__ is a relatively new addition in Binutils v2.40 PR29741, whereas using __DATA_REGION_LENGTH__ for .data size is a much older addition.

    Outcome may be that the linker script adopts the true size of .data but not its start address, resulting in incorrect errors from the linker (#971). In order to resolve #971, a configure test has been added that checks for PR29741, and only defines the mentioned symbols when PR29741 is available.

    A similar test has been added for PR31177 which is a similar feature for the .text region.

  • Due to several problem reports concerning the I/O headers for ATxmega64A1U and ATxmega128A1U (#391, #635, #643, #663, #875, #959, #960, #961), these headers have been updated to a more recent revision.

  • Added defines to avr/io.h that match the names in the ATmega324PA data sheet (#443).

  • Fixed signature definitions in avr/io.h for several devices (#877) and add some missing signatures (#878).

  • Add missing ATmega328PB power reduction switches PRPTC and PRSPI1 to avr/power.h (#668).

  • On AVRrc Reduced Tiny, add 0x4000 to the symbol address when pgm_get_far_address() takes the address of an object in PROGMEM_FAR. This works similar to how the compiler implements the &-operator for PROGMEM objects (#970).

  • Fixed memccpy (and memccpy_P) on AVRrc (#1018).

  • Fixed atoi and atol on AVRrc (#1019).

  • Define types from stdint.h like int32_t without attribute((mode)) (#496).

  • Fixed ld: undefined reference to E2END (#973).

  • Don't skip 2-word instructions on cores with an according silicon bug. This will fix AVR-LibC build warnings as mentioned in #994 like:
    libc/stdlib/ctype.S:80: Warning: skipping two-word instruction

  • The str[n]casecmp_PF functions used an algorithm that lead to different results compared to str[n]casecmp[_P]. The far versions have been fixed so that they comply to POSIX.1-2008 (#1009).

  • fflush() is now implemented as a proper (non-inline) function so that features like --wrap will work as expected. For the same reason, clearerr(), ferror() and feof() are no more implemented as macros but are proper (non-inline) functions, too. (#1017, #1003).

  • Distribution is missing dox_latex_header.tex, filter-dox.sh, avr-libc-logo-large.png from doc/api/ (#1023).

  • Fixed a typo in the parameter name of nanf (#1033).

  • INFINITY from math.h has been turned from double to float (#1036).

  • XRAMEND for ATmega128A is now defined to 0xffff (#629).

  • Fixed strftime's return value (#1040) and strftime("%r") (#1039).

  • Saturate the value that _delay_us / _delay_ms are passing down to __builtin_avr_delay_cycles in order to avoid UB (#681) for large values.

  • Respect freelist size for small realloc allocations (#660).

  • Let calloc return NULL when the alloc size overflows (#1007).

  • Fixed: realloc fails if extending block in-place crosses the address 0xffff (#922).

  • Fixed fuse defines for ATA5790 (#909).

  • Fixed the ADC_CH_MUXNEG_enum values for ATxmega256D3 (#661).

  • Fixed FUSE4_DEFAULT etc. defines in Xmega I/O headers (#523).

  • Fixed atoff forwarding from wrong strtod to correct strtof (#1052).

  • abort no more calls atexit functions or static destructors (#1056). abort doesn't forward to _exit(1) any more but to a new, weak label __abort located in section .fini4.

Pull Requests

  • Modernized the A simple project demo example project: It now uses the ATmega328P device that is widely used, for example on the Arduino Nano boards (#1044, #1048).

  • Fix support for ATxmega devices in avr/wdt.h (#646).

  • Improve runtime performance of free() (#991).

Other Changes

  • New news are now in NEWS.md and no more in NEWS.