迪文科技论坛

 找回密码
 立即注册
搜索
查看: 154|回复: 1

[Share]sdcc toolchain support

[复制链接]

1

主题

5

回帖

84

积分

注册会员

Rank: 2

积分
84
发表于 2024-3-25 20:51:09 | 显示全部楼层 |阅读模式
dwin released some C51 source codes for T5L core, in order to work with Keil developemnt tool. but I choose to use sdcc. After reading the source codes for Keil c51. I figured out only a few changes can make sdcc work as well.

1. put DWINT5 to the right place. I get this done by assmbly code. I put following code into T5L.as and link it to my firmware.
  1. .area CSEG (abs, CODE)
  2. .org 0xf8
  3. .globl __T5L_init__
  4. __T5L_init__: .db 0xff, 0xff
  5.               .db 'D','W','I','N','T','5'
复制代码


2. make sure initialize the registers at the beginning of the "main" function.
   
  1.         CKCON = 0x00;
  2.         T2CON = 0x70;
  3.         DPC = 0x00;
  4.         PAGESEL = 0x01;
  5.         D_PAGESEL = 0x02; //DATA RAM  0x8000-0xFFFF
  6.         MUX_SEL = 0x00;   //UART2,UART3关闭,WDT关闭
  7.         RAMMODE = 0x00;
复制代码


3.   make sure the linker included following options: --xram-loc 0x8000 --xram-size 0x7fff.
      because the external ram starts from 0x8000 to 0xffff, only 32k, not 65k.

4.   the sdcc has different mcs51 extentions vs Keil.   
      for example, all the keywords __xdata, __data, __sfr. everything has "__" as prefix. I have to go through all the SFR definitions to replace the Keil style with sdcc style.

Keil is the best 8051 compiler, but sdcc still works and free.
回复

使用道具 举报

0

主题

713

回帖

7658

积分

论坛元老

Rank: 8Rank: 8

积分
7658
发表于 2024-4-2 19:09:22 | 显示全部楼层
Dear,thank you for sharing your experience.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|迪文科技论坛 ( 京ICP备05033781号-1 )

GMT+8, 2024-12-28 16:40 , Processed in 0.076340 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表