I would like to know why we don't have support for AT89LP51RD2-ED2-ID2 microcontrollers from Atmel/Microchip? I know that these are supported in a 2.9.0 version of SDCC provided by Atmel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Isn't that just an 8051 clone, and thus should be supported by SDCC? Does Atmel's 2.9.0 version use the instruction set extensions, i.e. MAC and second data pointer?
Philipp
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there :)
It's not just a clone. It's a faster one and with 12 new instructions.
The MAC instruction seems to be interesting and I think that atmel's sdcc is not using it.
for that code:
#include".\teste.h"#include<AT89LP51RD2.h>#include<stdlib.h>#include<stdint.h>// Uncomment line below to skip static & global variable initialization// int _sdcc_external_startup() { return 1;}voidmain(void){uint16_taaa,bbb,ccc;aaa=0x11;bbb=0x22;ccc=aaa*bbb;while(1){;}}
which is probably not what you want. You might want to use "volatile" or do something that causes side effects for the compiler to actually do something.
(You do not seem to be using a recent version of SDCC)
Your code cannot be mapped to the AT89LP though. The MAC only operates on signed 16 bit.
Nothing stops you from using the MAC "by hand" though: loading the variables to the SFR (you can access them 16 bit wise) then issuing the MAC instruction via inline assembly, then reading the output SFR.
The include file AT89LP51RD2.h is not part of SDCC so it's not clear whether it already contains some MAC support. The include file which might come closest on SDCC's side is probably device/include/mcs51/C8051F120.h (also has a MAC).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Frieder!
Thanks for your response.
I misread the datasheet and the MAC is indeed for signed 16bit.
The used SDCC was adapted by ATMEL. I'm using it just to see if they are using some of the 12 new instructions.
#include".\teste.h"#include<AT89LP51RD2.h>#include<stdlib.h>#include<stdint.h>// Uncomment line below to skip static & global variable initialization// int _sdcc_external_startup() { return 1;}voidmain(void){volatileint16_taaa,bbb,ccc;aaa=0x11;bbb=0x22;while(1){ccc=aaa*bbb;aaa++;bbb--;ccc=0;}}
Hi,
I would like to know why we don't have support for AT89LP51RD2-ED2-ID2 microcontrollers from Atmel/Microchip? I know that these are supported in a 2.9.0 version of SDCC provided by Atmel.
What is the difference between the AT89LP51ED2 and the AT89C51ED2? Would that require a new header file? Or what kind of support are you looking for?
Isn't that just an 8051 clone, and thus should be supported by SDCC? Does Atmel's 2.9.0 version use the instruction set extensions, i.e. MAC and second data pointer?
Philipp
Hi there :)
It's not just a clone. It's a faster one and with 12 new instructions.
The MAC instruction seems to be interesting and I think that atmel's sdcc is not using it.
for that code:
I get that disassembly:
Do you think that is possible to optimize a little bit the sdcc (mcs51) to the AT89LP?
AN_3716 - Migrating from AT89C51RB2/RC2/RD2/ED2/IC2/ID2 to AT89LP51RB2/RC2/RD2/ED2/IC2/ID2
Last edit: Cristiano Rodrigues 2017-03-31
Hi Christiano,
within the above disassembly the code generated for your function void main(void) is just
which is probably not what you want. You might want to use "volatile" or do something that causes side effects for the compiler to actually do something.
(You do not seem to be using a recent version of SDCC)
Your code cannot be mapped to the AT89LP though. The MAC only operates on signed 16 bit.
Nothing stops you from using the MAC "by hand" though: loading the variables to the SFR (you can access them 16 bit wise) then issuing the MAC instruction via inline assembly, then reading the output SFR.
The include file AT89LP51RD2.h is not part of SDCC so it's not clear whether it already contains some MAC support. The include file which might come closest on SDCC's side is probably device/include/mcs51/C8051F120.h (also has a MAC).
Hi Frieder!
Thanks for your response.
I misread the datasheet and the MAC is indeed for signed 16bit.
The used SDCC was adapted by ATMEL. I'm using it just to see if they are using some of the 12 new instructions.
Small Device C Compiler (SDCC) Version 2.9.0 - Source
here it is the AT89LP51RD2.h made by Atmel
C code:
Disassembly
It seems that they are using the standard MUL.
I will try what you said. However, getting the result from the M register seems to be a little bit tricky
AFAIK the Atmel version of SDCC is identical to our 2.9.0 version with only added header files.