I'm trying to build a project that was originally built in Atmel Studio which compiled fine without any errors or warnings, but if I try to build the project in the ImageCraft IDE it says there are no errors but it will fail to build.
Source code snippet of what I'm trying to build in ImageCraft:
static inline void PORTA_set_pin_pull_mode(const uint8_t pin, const enum port_pull_mode pull_mode)
{
if (pull_mode == PORT_PULL_UP)
{
DDRA &= ~(1 << pin);
PORTA |= 1 << pin;
}
else if (pull_mode == PORT_PULL_OFF)
{
PORTA &= ~(1 << pin);
}
}
This is the outcome of the build log
iccavr.exe: 'C:\iccv8avr\bin\iccomavr.exe' returns error code -1073741819 Process terminated with status -1073741819 (0 minute(s), 2 second(s)) Build Failed: 0 error(s), 158 warning(s) (0 minute(s), 2 second(s))
The warnings that are showing when trying to build the project
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(63):[warning] Illegal storage class __flash for parameter 'pin'. Storage class removed.
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(63):[warning] Illegal storage class __flash for parameter 'pull_mode'. Storage class removed.
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(92):[warning] Illegal storage class __flash for parameter 'mask'. Storage class removed.
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(92):[warning] Illegal storage class __flash for parameter 'direction'. Storage class removed.
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(123):[warning] Illegal storage class __flash for parameter 'pin'. Storage class removed.
!W C:\Sahil\Basic WifiBuild\WifiBoard\include\port.h(123):[warning] Illegal storage class __flash for parameter 'direction'. Storage class removed.
__flash
is a named address space used to specify that some constant
should be kept in flash memory, instead of being copied to the .data
section of RAM at program startup. It is not really standard C, but
belongs to a set of extensions called embedded C. It is a very
useful feature on AVR, which helps save precious RAM. It is supported
by gcc, and apparently used by the port.h header you are trying to
compile with your code.
From the warnings you show, it would seem your compiler does not support
this feature. You could try to #define __flash
as an empty string
before including the header. But then you will loose the benefit of this
RAM-saver.