Coder Social home page Coder Social logo

stm8_headers's People

Contributors

gicking avatar maxgerhardt 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

Watchers

 avatar  avatar  avatar  avatar  avatar

stm8_headers's Issues

Are reset values correct for STM8 registers?

First, this is really nice work, so legible. Thanks!

Reading through STM8SF103F3.h and comparing it to ST's RM0016 I think I found some inconsistancies.

Here it seems that the reset values for some of the ADC registers that have H and L parts are swapped. For example:

  /** ADC high threshold register high (HTRH at 0x5408) */
  union {

    /// bytewise access to HTRH
    uint8_t  byte;

    /// bitwise access to register HTRH
    struct {
      BITS   HT                  : 8;      // bits 0-7
    };  // HTRH bitfield

    /// register _ADC1_HTRH reset value
    #define sfr_ADC1_HTRH_RESET_VALUE   ((uint8_t) 0x03)

  } HTRH;


  /** ADC high threshold register low (HTRL at 0x5409) */
  union {

    /// bytewise access to HTRL
    uint8_t  byte;

    /// bitwise access to register HTRL
    struct {
      BITS   HT                  : 2;      // bits 0-1
      BITS                       : 6;      // 6 bits
    };  // HTRL bitfield

    /// register _ADC1_HTRL reset value
    #define sfr_ADC1_HTRL_RESET_VALUE   ((uint8_t) 0xFF)

  } HTRL;

It seems to me that sfr_ADC1_HTRH_RESET_VALUE is swapped with sfr_ADC1_HTRL_RESET_VALUE as the values done match the bit field sizes.

I did a quick check of other non-zero RESET_VALUEs and also found:

/** SPI Rx CRC register (RXCRCR at 0x5206) */
 union {

   /// bytewise access to RXCRCR
   uint8_t  byte;

   /// bitwise access to register RXCRCR
   struct {
     BITS   RXCRC               : 8;      // bits 0-7
   };  // RXCRCR bitfield

   /// register _SPI_RXCRCR reset value
   #define sfr_SPI_RXCRCR_RESET_VALUE   ((uint8_t) 0xFF)

 } RXCRCR;


 /** SPI Tx CRC register (TXCRCR at 0x5207) */
 union {

   /// bytewise access to TXCRCR
   uint8_t  byte;

   /// bitwise access to register TXCRCR
   struct {
     BITS   TXCRC               : 8;      // bits 0-7
   };  // TXCRCR bitfield

   /// register _SPI_TXCRCR reset value
   #define sfr_SPI_TXCRCR_RESET_VALUE   ((uint8_t) 0xFF)

 } TXCRCR;

It seems likely that these don't really have sensible reset values, but according to RM00016 if they did, it would be 0x00, not 0xFF.

SDCC not work with stm8

i am use this cmd (sdcc --Werror --std-sdcc99 -mstm8 -DSTM8S103F3 -c C:\Users\techs\Desktop\STM8s103F\main.c -o C:\Users\techs\Desktop\STM8s103F\Output/STM8s103F.o )
sdcpp.exe: fatal error: when writing output to : Invalid argument

include\STM8S103F3.h:1903: syntax error: token -> 'volatile' ; column 29

please healp me

Missing bitfield names in header files

Some headers are missing many bitfield names which renders them quite unusable.

$ grep '^      BITFIELD_UINT' -R * | less
...
STM8S105K4.h:      BITFIELD_UINT   SWIMCLK    : 1;      // bit 0
STM8S105K4.h:      BITFIELD_UINT              : 7;      // 7 bits
STM8S105K4.h:      BITFIELD_UINT   C          : 1;      // bit 0
STM8S105K4.h:      BITFIELD_UINT   Z          : 1;      // bit 1
STM8S105K4.h:      BITFIELD_UINT   NF         : 1;      // bit 2
STM8S105K4.h:      BITFIELD_UINT   I0         : 1;      // bit 3
STM8S105K4.h:      BITFIELD_UINT   H          : 1;      // bit 4
STM8S105K4.h:      BITFIELD_UINT   I1         : 1;      // bit 5
STM8S105K4.h:      BITFIELD_UINT              : 1;      // 1 bit
STM8S105K4.h:      BITFIELD_UINT   V          : 1;      // bit 7
STM8S105K4.h:      BITFIELD_UINT   SWO        : 1;      // bit 0
STM8S105K4.h:      BITFIELD_UINT   AL         : 1;      // bit 1
STM8S105K4.h:      BITFIELD_UINT              : 6;      // 6 bits
STM8S105K4.h:      BITFIELD_UINT   FIX        : 1;      // bit 0
STM8S105K4.h:      BITFIELD_UINT   IE         : 1;      // bit 1
STM8S105K4.h:      BITFIELD_UINT   AHALT      : 1;      // bit 2
STM8S105K4.h:      BITFIELD_UINT   HALT       : 1;      // bit 3
STM8S105K4.h:      BITFIELD_UINT              : 4;      // 4 bits
STM8S105K4.h:      BITFIELD_UINT   PRG        : 1;      // bit 0
STM8S105K4.h:      BITFIELD_UINT              : 3;      // 3 bits
STM8S105K4.h:      BITFIELD_UINT   FPRG       : 1;      // bit 4
...

Why BITS?

What is the motivation for the BITS macro?
Wouldn't it work just as well, to just use unsigned int as type for for the bitfields, and not define the BITS macro at all? Especially since a name like BITS has a high risk of clashing with an identifier from the user?

Document relationship between svd xml and h

This repository contains .svd, .sxml and .h files.

Over at SourceForge, there is a ticket for adding the headers to SDCC: https://sourceforge.net/p/sdcc/patches/367/
If SDCC would add the h files, would those be the preferred form for modification?

What is the relation between the svd, xml and h files? Which are generated from which using which tool? Which is the preferred form for making modifications?

STLUX385 support

There currently is not header for the STLUX 385. AFAIK, ST replaced it by the STLUX385A, but the older STLUX385 is still widely available at distributors.

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.