Giter VIP home page Giter VIP logo

ch554_sdcc's People

Contributors

cibomahto avatar deqingsun avatar jjmz avatar kprasadvnsi avatar limingjie avatar mogenson avatar nerdralph avatar qianfan-zhao avatar rabid-inventor avatar t0mpr1c3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ch554_sdcc's Issues

My CH544 is a Bootloader 2.31 ...

I'm stuck on Linux today ... wondering about this error.
rasyoung@vic2016:~/code_test/8051/wch/ch554_sdcc/examples/pwm$ sudo make flash
wchisptool -f pwm.bin -g
Error while bulking in: LIBUSB_ERROR_OVERFLOW
Libre CH551 Flasher 2018
The chip id 0xFFFFFFD0 is currently not support in this program

Do you know fix for this ? Thanks for excellent postings!

UsbHostHub_KM example fails to compile

sdcc -c -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/home/bdroy/CH55x-base/ch554_sdcc/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 ../../include/debug.c

/usr/bin/sdcpp -nostdinc -Wall -std=c11 -I/home/bdroy/CH55x-base/ch554_sdcc/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=4_0_7 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=0 -D__SDCC_VERSION_PATCH=7 -DSDCC=407 -D__SDCC_REVISION=11994 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/local/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/local/share/sdcc/include ../../include/debug.c

/usr/bin/sdas8051 -plosgffw debug.rel debug.asm
sdcc UsbHostHub_KM.rel usbhost.rel debug.rel -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/home/bdroy/CH55x-base/ch554_sdcc/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -o UsbHostHub_KM.ihx

/usr/bin/sdld -nf UsbHostHub_KM.lk
?ASlink-Error-Could not get 46 consecutive bytes in internal RAM for area DSEG.

/usr/bin/sdld -nf UsbHostHub_KM.lk returned errorcode 256
make: *** [../Makefile.include:40: UsbHostHub_KM.ihx] Error 1

$sdcc --version
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.7 #11994 (Linux)
published under GNU General Public License (GPL)

$lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.10
Release: 20.10
Codename: groovy

If I delete the usb_host_KM dir from examples, all the rest build correctly.

Misused `&=` operator in method `ADCInit()`

I am writing an email to [email protected] for this issue. Also submit an issue here, in case anyone meets the same problem.

The &= operator is misused in the ADCInit() method in adc.c. The expression on the right side of the operator &= will be calculated first, it may lead to an unexpected value in a certain case.

ADC_CFG &= ~bADC_CLK | speed;

// It implies
ADC_CFG = ADC_CFG & (~bADC_CLK | speed);

The 3rd case failed to set the bit.

- 0x00 & (0xfe | 0) = 0x0
- 0x01 & (0xfe | 0) = 0x0
- 0x00 & (0xfe | 1) = 0x0 // Failed to set the bit
- 0x01 & (0xfe | 1) = 0x1

It should have been like this.

ADC_CFG = ADC_CFG & ~bADC_CLK | speed;

All cases work as expected.

- 0x00 & 0xfe | 0 = 0x0
- 0x01 & 0xfe | 0 = 0x0
- 0x00 & 0xfe | 1 = 0x1
- 0x01 & 0xfe | 1 = 0x1

make debug.c components optional to save code size

I was able to reduce the compiled size of the blink example from 700B to 232B by conditionally excluding the UART functions. Another 36B can be saved by excluding the WDT functions. Instead of adding #ifdef BUILD_UART around the code, another option would be to break up debug.c into separate files and build it as a library. Then the linker will only pull in .rel files that are actually used.

Is it possible to rewrite the description without unnecessary words?

Like, now let's compile and oops nothing happened!
These superfluous words, expressions and actions are very annoying, because at least they spend time.

I would understand if it was some kind of novel or other literary adventure.
But I think people coming here hope to quickly connect everything and make everything work right away.

Without experimentation or other adventures.

Thank's

Chinese characters

Hello good people,
Not an issue with SDCC or CH554 per se , but ...
I downloaded the SDCC source from the blinkinlabs repo. When I open the code with VScode, i am able to see the chinese comments which I am able to translate with google.
when I download the code repo from the WCH website (for Keil) the chinese comments are not rendered properly. Is there any advice on how to get the comments in a translatable format ?
I am trying to use CH554 as a logger with a USB pen drive. I think udrive is still not ported to SDCC.
TIA

Win7 needs Zadig driver setup

I was getting an error in the device manager for my WCH551 and WCH552 boards.
I tried setting the driver to libusbK using zadig, and still got an error. libusb-win32 worked.
The CH552 VID/PID is 4348 55E0.

ws2812 Makefile correction

The Makefile sets "CPU_FREQ = 16000000" - which is incorrect and does nothing; it should read 'FREQ_SYS = 16000000'

Some examples broken with SDCC 4.2.0

At least 'usb_host_KM' is broken with SDCC 4.2.0 in Debian 12. It complies under SDCC 4.0.0 in Debian 11.

Specifically:

make[1]: Entering directory '/build/examples/usb_host_KM'
sdcc -c -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 UsbHostHub_KM.c
+ /usr/bin/sdcpp -nostdinc -Wall -std=c11 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCCCALL=0 -D__SDCC=4_2_0 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=2 -D__SDCC_VERSION_PATCH=0 -DSDCC=420 -D__SDCC_REVISION=13081 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/share/sdcc/include  UsbHostHub_KM.c 
/build/examples/../include/debug.h:52: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
+ /usr/bin/sdas8051 -plosgffw UsbHostHub_KM.rel UsbHostHub_KM.asm
sdcc -c -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 usbhost.c
+ /usr/bin/sdcpp -nostdinc -Wall -std=c11 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCCCALL=0 -D__SDCC=4_2_0 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=2 -D__SDCC_VERSION_PATCH=0 -DSDCC=420 -D__SDCC_REVISION=13081 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/share/sdcc/include  usbhost.c 
usbhost.c:82: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
usbhost.c:924: warning 84: 'auto' variable 's' may be used before initialization
usbhost.c:1408: warning 84: 'auto' variable 'i' may be used before initialization
+ /usr/bin/sdas8051 -plosgffw usbhost.rel usbhost.asm
sdcc -c -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 ../../include/debug.c
+ /usr/bin/sdcpp -nostdinc -Wall -std=c11 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCCCALL=0 -D__SDCC=4_2_0 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=2 -D__SDCC_VERSION_PATCH=0 -DSDCC=420 -D__SDCC_REVISION=13081 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/bin/../share/sdcc/include/mcs51 -isystem /usr/share/sdcc/include/mcs51 -isystem /usr/bin/../share/sdcc/include -isystem /usr/share/sdcc/include  ../../include/debug.c 
+ /usr/bin/sdas8051 -plosgffw debug.rel debug.asm
sdcc UsbHostHub_KM.rel usbhost.rel debug.rel -V -mmcs51 --model-small --xram-size 0x380 --xram-loc 0x080 --code-size 0x3800 -I/build/examples/../include -DFREQ_SYS=16000000 -DMAX_PACKET_SIZE=64 -o UsbHostHub_KM.ihx
+ /usr/bin/sdld -nf UsbHostHub_KM.lk
?ASlink-Error-Could not get 46 consecutive bytes in internal RAM for area DSEG.
+ /usr/bin/sdld -nf UsbHostHub_KM.lk returned errorcode 256
make[1]: *** [../Makefile.include:40: UsbHostHub_KM.ihx] Error 1
make[1]: Leaving directory '/build/examples/usb_host_KM'
make: *** [Makefile:6: usb_host_KM/] Error 2
make: *** [Makefile:19: build] Error 2

CH554%20manual%20english.pdf

Have one error on the translation Table 5.3.1 General 8051 Register List
A,ACC correct Adress is E0h not DOh as is written on the pdf

reconsider 24Mhz for USB CDC

The datasheet is confusing about what voltages are supported at different clock speeds and temperatures. TA32M states >28MHz is supported in the range of -20C to 70C vs <28MHz is OK from -40C to 85C. Then in table 18.4, Fsys at 24M is specified as requiring 4.4V. I think 24M is safe with VCC >= 3V3 at normal temperature ranges.
For the USB CDC example, where the MCU is most likely powered from VBUS (USB 5V), in which case 24M should be safe over the full temperature range.
The benefit of 24M over 16M is much more accurate UART timing at high speeds. At 16M, the counter reload value for 115.2kbps is 9 vs an ideal value of 8.68, making the timing 3.5% slow. At 24M, the reload value will be 13 vs an ideal of 13.02, making it only 0.16% fast.

Linux flash tools

One of the utilities mentioned in the readme - LibreCH551 - appears to be abandoned, and doesn't work with current chips (or, at least, not with current bootloaders on current chips). I'd recommend removing it from the readme, as well as using a different tool in your Makefiles

I've found a handful of alternative utilities that DO work:

VNPro (patched for more CH55x chips) (https://github.com/LoveMHz/vnproch55x)
This is what's used in ch55xduino

ch55x-isptool (https://github.com/ElectronicCats/ch55x-isptool)

chflasher (https://github.com/atc1441/chflasher)

ws2812 example does not compile under Windows MinGW

Tested with SDCC 4.0.0 #11528 (MINGW64)

The error reported is:
main.c:5:19: fatal error: ch554.h: No such file or directory

You have to change

#include <ch554.h>
#include <debug.h>

to

#include "../../include/ch554.h"
#include "../../include/debug.h"

If you use Linux subsystem for windows, you don't need

You don't need MinGW, I would suggest that you consider that some users will have the Linux subsystem for windows installed, Who will have the goods from both worlds Windows and Linux turning the work a little easyer

Take a look on what I'm talking about

Software i2c

Is there any plan to add software i2c support?

To the best of my knowledge, the CH554 doesn't have hardware i2c support and the official SDK doesn't provide a software implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.