Giter VIP home page Giter VIP logo

Comments (6)

ricklon avatar ricklon commented on June 26, 2024

From Mark Sproul:

const

works the same as PROGMEM.

from chipkit32-max.

ricklon avatar ricklon commented on June 26, 2024

He's verifying that.

from chipkit32-max.

ricklon avatar ricklon commented on June 26, 2024

Sorry, he checked and it's not the equivalent.

from chipkit32-max.

nkcelectronics avatar nkcelectronics commented on June 26, 2024

The solution is around const, but we need to understand better what is happening under the hood...

with and without const the errors I get are different (different sections of memory)

I also found that using const_cast is a way to cast correctly between variables with const and regular variables

from chipkit32-max.

msproul avatar msproul commented on June 26, 2024

Under closer checking, const does indeed put data into the flash memory space. Definitions for all of the prog_char etc data types have been added to the wiring.h file. <avr/pgmspace.h> is not needed, besides its avr only
The proper way to do this in a program that is going to use memory is

#if defined(AVR)
#include <avr/pgmspace.h>
#endif

this way if the program gets used under avr, the prog_char defs are present. They are automatically included for pic32

Mark

from chipkit32-max.

nkcelectronics avatar nkcelectronics commented on June 26, 2024

Some guideline should be written about using const, as accessing libraries that are not expecting const variables can result in a compilation error. cost_cast must be used.

from chipkit32-max.

Related Issues (20)

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.