GithubHelp home page GithubHelp logo

lujji / stm8-bare-min Goto Github PK

View Code? Open in Web Editor NEW
118.0 14.0 37.0 87 KB

Tiny peripheral library for STM8 microcontrolles

License: MIT License

C 98.19% Python 1.01% Makefile 0.39% Assembly 0.41%
stm8 sdcc peripheral-drivers examples

stm8-bare-min's People

Contributors

gicking avatar johschmitz avatar lhoyosm avatar liyanboy74 avatar lujji 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

stm8-bare-min's Issues

bit access optimization peephole rules

Dear lujji,

sorry for breaking your peephole rules for optimizing bit access on registers. In revision #9990, I made some changes in SDCC, resulting in

	ld	a, 0x500f
	xor	a, #0x10
	ld	0x500f, a

instead of the previously generated code

	ld	a, 0x500f
	xor	a, #0x10
	ldw	x, #0x500f
	ld	(x), a

This will probably require an update of your peephole rules.

Philipp

P.S.: While far less elegant (it uses SDCC language extensions instead of standard C) the following way of declaring the I/O registers currently allows more optimizations:

volatile uint8_t __at(0x500f) PD_ODR;

Edit: Inserted missing volatile.

RAM tutorial question

hi lujji,

thanks a lot for your excellent tutorial! I really marvel at your minimalist approach :-) The RAM example worked out of the box and is easy to understand :-) However, I still have some questions / remarks:

  1. do I understand correctly that this approach requires that the RAM routines don't use absolute jumps within RAM or calls between RAM routines...? Because the .map file shows e.g. RAM0 in flash at 0x81E6. If my understanding is correct, how do you ensure that absolute jumps/calls within RAM are not used by SDCC?

  2. and if absolute jumps or calls within RAM are required for some reason, how about this (different) procedure (for example @ 0x00a0):

    a) link for RAM (-Wl-bRAM0=0x00a0) --> absolute addresses are ok, but in hexfile code is in RAM and is lost after reset (already verified)

    b) in hexfile move code segment from RAM to flash address --> is not lost after reset, but located at wrong address. I plan to add this "move" feature to hexfile_merger within the next few days

    c) copy to same RAM address as above just like you already do, but with an additional __at (0x00a0) for f_ram[] to ensure the correct address.

Optionally one could also reserve a buffer of sufficient size in RAM @ 0x00a0 (or wherever) via linker and only point *f_ram to that address in the main program.

The main issue I see is how to pass the parameters like link address and code length between the different tools/steps.

I understand that this is not minimalist anymore (sorry for that!). But is my understanding correct and, if yes, any idea how to perform this in a fool-proof way?

Thanks again for your great tutorials and have a great day! :-)

Regards,
Georg / gicking

license?

Hi, is this code available under a particular license? Thanks!

bad timer 2 address

Hi !

in file stm8s.h ( for stm8s ) says:

/* TIM2 (mutually exclusive with TIM5) */
#define TIM2_BASE_ADDRESS 5300

it should be:

/* TIM2 (mutually exclusive with TIM5) */
#define TIM2_BASE_ADDRESS ox5300

It took me a couple of hours debugging a non functioning timer, until I started
looking at the assembly code.

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.