CSY-tvgo / Keil-C51-C-to-SDCC-C-Converter

Convert your Keil C51 C code to SDCC C code in browser. // 在网页中把你的 Keil C51 C 代码转换成 SDCC C 代码。
https://CSY-tvgo.github.io/Keil-C51-C-to-SDCC-C-Converter/
MIT License
26 stars 4 forks source link

Can this convert header from keil to sdcc? #1

Open physxz opened 2 years ago

physxz commented 2 years ago

Keil has a header called intrins.h. I want to convert this keil file to the format of sdcc, and use the function in it. I tried many ways but none of the worked. Here's the header:

/*--------------------------------------------------------------------------
INTRINS.H
Intrinsic functions for C51.
Copyright (c) 1988-2004 Keil Elektronik GmbH and Keil Software, Inc.
All rights reserved.
--------------------------------------------------------------------------*/

#ifndef __INTRINS_H__
#define __INTRINS_H__

extern void          _nop_     (void);
extern bit           _testbit_ (bit);
extern unsigned char _cror_    (unsigned char, unsigned char);
extern unsigned int  _iror_    (unsigned int,  unsigned char);
extern unsigned long _lror_    (unsigned long, unsigned char);
extern unsigned char _crol_    (unsigned char, unsigned char);
extern unsigned int  _irol_    (unsigned int,  unsigned char);
extern unsigned long _lrol_    (unsigned long, unsigned char);
extern unsigned char _chkfloat_(float);
extern void          _push_    (unsigned char _sfr);
extern void          _pop_     (unsigned char _sfr);

#endif

Any suggestion? Thanks a lot!

physxz commented 2 years ago

I tried your tool, but it seems don't work for me.

CSY-tvgo commented 2 years ago

Hi. Currently, this tool can be mainly used to convert application-level code and header files of some MCUs.
However, intrins.h is a header file related to compilers, while Keil's compiler is different from SDCC, so you might convert it manually.

CSY-tvgo commented 2 years ago

I found two pages that may offer some help for you:

physxz commented 2 years ago

First of all, thank you for your time. I've read all these posts already. But honestly I don't konw how to do it since I'm not a professional guy. The SDCC Compiler User Guide is no easy to read too. I met a new problem yesterday. The printf() function. I think I'm gonna use keil instead if I can't conquer this trouble today. It's too hard for some aspect for a newbee.