ccollins476ad commented on issue #260: [RFC] `$import` directive
URL: https://github.com/apache/mynewt-newt/pull/260#issuecomment-457392854
 
 
   Thanks @benmccrea, those are good questions.  It turns out my testing of 
this feature left much to be desired; I discovered a bug while coming up with a 
response!  I have pushed the fix.
   
   I am using different settings here than the specific ones you asked about 
(`OS_DEBUG_MODE`->`HAL_FLASH_VERIFY_ERASES`, 
`OICMGR_TRANS_SECURITY`->`HAL_FLASH_VERIFY_BUF_SZ`).  This allows a more basic 
target with a simpler syscfg.  There are three files:
   
   #### `targets/my_blinky_sim/syscfg.yml`:
   ```
   $import:
       - 'misc/importa.yml'
       - 'misc/importb.yml'
   
   syscfg.vals:
       HAL_FLASH_VERIFY_ERASES: 1
   ```
   
   #### `misc/importa.yml`:
   ```
   syscfg.vals:
       HAL_FLASH_VERIFY_BUF_SZ: 32
   ```
   
   #### `misc/importb.yml`:
   ```
   syscfg.vals:
       HAL_FLASH_VERIFY_BUF_SZ: 16
   ```
   
   Newt generated the following HAL syscfg for this target:
   ```
   [@apache-mynewt-core/hw/hal]
     HAL_FLASH_VERIFY_BUF_SZ: 16 (overridden by targets/my_blinky_sim)
     HAL_FLASH_VERIFY_ERASES: 1 (overridden by targets/my_blinky_sim)
     HAL_FLASH_VERIFY_WRITES: 0
   ```
   
   If we reverse the order of the imports (i.e., `importb` before `importa`), 
then the syscfg changes:
   ```
   [@apache-mynewt-core/hw/hal]
     HAL_FLASH_VERIFY_BUF_SZ: 32 (overridden by targets/my_blinky_sim)
     HAL_FLASH_VERIFY_ERASES: 1 (overridden by targets/my_blinky_sim)
     HAL_FLASH_VERIFY_WRITES: 0
   ```
   
   So, import order matters, which I think is the correct behavior.  This is 
something that should be documented.  Imports are processed in the specified 
order, then the importing file is processed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to