Giter Site home page Giter Site logo

Comments (3)

patacongo avatar patacongo commented on August 19, 2024

This logic seems to be wrong,(**&& !defined(KERNEL**))seems redundant.
This error looks like copying a line of code, changing it, but forgetting to delete the extra parts.
To be honest, I often make this kind of mistakes.

#elif defined(CONFIG_BUILD_KERNEL) && !defined(KERNEL)

No, it is not redundant CONFIGI_BUILD_KERNEL and __KERNEL__ mean very different things. The first is a build mode much like Linux where the kernel is built as a separately linked blob and applications a build as separately linked process blobs.

__KERNEL__ is an indication that we are currently compiling a portion of the kernel code. __KERNEL__ is valid is all build modes.

So the too definitions are not related and it is correct to specify both.

# if defined(**KERNEL**)

/* Kernel build. Kernel code has direct access */
# define __DIRECT_ERRNO_ACCESS 1
# else

/* User libraries for the kernel. Only indirect access from user
* libraries
*/
# undef __DIRECT_ERRNO_ACCESS
# endif

#endif

This is also correct. When we are build internal components of the OS then __KERNEL__ will be defined and is is correct to access the errno variable in a different way by directly accessin OS internal data.

Code that is not part of the internal OS components must use the indirect method by accessing the fake variable errno. That is indirect in the since the errno is really a function call and may even translate to an OS system call in certain build modes.

So it all looks correct to me and all makes good sense.

from nuttx.

yanyunyouyou avatar yanyunyouyou commented on August 19, 2024

Thank you for your detailed reply. I need some time to understand. As an electronic engineer, I am not familiar with complex kernel compilation. Thank you again for your reply.

from nuttx.

xiaoxiang781216 avatar xiaoxiang781216 commented on August 19, 2024

@yanyunyouyou I will close this issue since @patacongo already gave a detailed explanation.

from nuttx.

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.