You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/12 15:49:23 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5727: arch/ceva: Move the idle stack initialization to up_initial_state

xiaoxiang781216 opened a new pull request #5727:
URL: https://github.com/apache/incubator-nuttx/pull/5727


   ## Summary
   to follow other arch's implementation
   
   ## Impact
   Minor, code refactor
   
   ## Testing
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko merged pull request #5727: arch/ceva: Move the idle stack initialization to up_initial_state

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged pull request #5727:
URL: https://github.com/apache/incubator-nuttx/pull/5727


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5727: arch/ceva: Move the idle stack initialization to up_initial_state

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5727:
URL: https://github.com/apache/incubator-nuttx/pull/5727#discussion_r825339785



##########
File path: arch/ceva/src/common/up_createstack.c
##########
@@ -233,6 +233,11 @@ void up_stack_color(FAR void *stackbase, size_t nbytes)
   uint32_t *stkptr = stackbase;
   size_t    nwords = nbytes / sizeof(uint32_t);
 
+  if (nwords == 0)
+    {
+      nwords = (uint32_t *)up_getsp() - stkptr;
+    }
+

Review comment:
       Can we somehow unify code for `up_stack_color` across the platforms? I see the API that implement the same with a different code:
   ```
   void up_stack_color(FAR void *stackbase, size_t nbytes)
   {
     uintptr_t start;
     uintptr_t end;
     size_t nwords;
     FAR uint32_t *ptr;
   
     /* Take extra care that we do not write outside the stack boundaries */
   
     start = INT32_ALIGN_UP((uintptr_t)stackbase);
     end   = nbytes ? INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes) :
             up_getsp(); /* 0: colorize the running stack */
   
     /* Get the adjusted size based on the top and bottom of the stack */
   
     nwords = (end - start) >> 2;
     ptr  = (FAR uint32_t *)start;
   
     /* Set the entire stack to the coloration value */
   
     while (nwords-- > 0)
       {
         *ptr++ = STACK_COLOR;
       }
   }
   ```
   and
   ```
   void up_stack_color(FAR void *stackbase, size_t nbytes)
   {
     /* Take extra care that we do not write outsize the stack boundaries */
   
     uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3);
     uintptr_t stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) :
                        up_getsp(); /* 0: colorize the running stack */
     size_t    nwords = (stkend - (uintptr_t)stackbase) >> 2;
   
     /* Set the entire stack to the coloration value */
   
     while (nwords-- > 0)
       {
         *stkptr++ = STACK_COLOR;
       }
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5727: arch/ceva: Move the idle stack initialization to up_initial_state

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5727:
URL: https://github.com/apache/incubator-nuttx/pull/5727#discussion_r825347454



##########
File path: arch/ceva/src/common/up_createstack.c
##########
@@ -233,6 +233,11 @@ void up_stack_color(FAR void *stackbase, size_t nbytes)
   uint32_t *stkptr = stackbase;
   size_t    nwords = nbytes / sizeof(uint32_t);
 
+  if (nwords == 0)
+    {
+      nwords = (uint32_t *)up_getsp() - stkptr;
+    }
+

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org