From: Michel Pollet Date: Thu, 6 Mar 2014 16:33:00 +0000 (+0000) Subject: ELF: Make sure the macro generater the correct value X-Git-Tag: v1.2~14 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=fde567e3803f69614948b937c14184e0b6a0f308;p=sx%2Fsimavr.git ELF: Make sure the macro generater the correct value You could pass constants over 8 bits in size, generating very confusing values Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/avr/avr_mcu_section.h b/simavr/sim/avr/avr_mcu_section.h index 68558eb..597858a 100644 --- a/simavr/sim/avr/avr_mcu_section.h +++ b/simavr/sim/avr/avr_mcu_section.h @@ -187,9 +187,9 @@ struct avr_mmcu_vcd_trace_t { */ #define AVR_MCU_EXTERNAL_PORT_PULL(_port, _mask, _val) \ AVR_MCU_LONG(AVR_MMCU_TAG_PORT_EXTERNAL_PULL, \ - (((unsigned long)(_port) << 16) | \ - ((unsigned long)(_mask) << 8) | \ - (_val))); + (((unsigned long)((_port)&0xff) << 16) | \ + ((unsigned long)((_mask)&0xff) << 8) | \ + ((_val)&0xff))); /*! * This tag allows you to specify the voltages used by your board