On Monday, July 24, 2017 at 4:16:38 PM UTC-4, pat...@gmail.com wrote:
For true baremetal stuff I guess a good starting point is to take a look at the Xilinx BSP source code:C:\Xilinx\SDK\2017.2\data\embeddedsw\lib\bsp\standalone_v6_3\src\arm\cortexa9\gccI don't remember the details regarding DDR but if I recall correctly, some of the initialization is done in ps7_init.c which is generated during export of the bitstream with Vivado. You probably also need to set the MMU properly in the PS
To add the hardware configuration to the project paths:
1. Right-click the project and select 'Properties'
2. Select 'C/C++ General >> Paths and Symbols'
3. In the 'Includes' tab select 'Add..."
4. Select 'Workspace...' and select the hardware configuration folder (probably ending in "_wrapper_hw_platform_0") and select 'OK'
To add the ps7_init.c file to you're project:
1. Right-click the 'src' folder for your project (or any other source folder in your project)
2. Select 'New >> File'
3. Click 'Advanced >>' and select 'Link to file in the file system'
4. Click 'Browse...' and select the ps7_init.c file from your hardware configuration folder and click 'Open'
5. Click 'Finish'
Now you can add an #include "ps7_init.h" directive to your project and make a call to ps7_init(). If you created your project with a standalone project template, you should see this include and a call to ps7_init that has been commented out in your platform.c file:
void
init_platform()
{
/*
* If you want to run this example outside of SDK,
* uncomment one of the following two lines and also #include "ps7_init.h"
* or #include "ps7_init.h" at the top, depending on the target.
* Make sure that the ps7/psu_init.c and ps7/psu_init.h files are included
* along with this example source files for compilation.
*/
/* ps7_init();*/
/* psu_init();*/
enable_caches();
init_uart();
}
You can also have all of the initialization done by FSBL and then combine the two when generating your boot image. I'm not sure exactly what you're trying to accomplish so let me know if this makes sense with the setup you have or if you have any questions about the process.
On Monday, July 24, 2017 at 1:23:15 PM UTC-7, hedg...@gmail.com wrote:
Yes and no, afaict. With MMU disabled and DDR controller enabled, I should be able to access the full 1 GB of DRAM without dabrt. I have mmu disabled but ddr is not enabled. Been snooping through the sources for dram code, still cant find anything though. Uboot wasn't helpful, since uboot is a monster of a project with compat files for every board its compatible with. However, I'm going to keep on looking and see what I can find. ps7_init will definitely have dram init code as well, haven't had a chance to look yet though. I can only find info on the mmu from disassembling a simple hello_world app built with the xsdk, though, and the dram initialization details should be in there. I'll look at taking another look with raw gdb at a debug build of a hello_world app on the metal and see if I dabrt by writing directly to DRAM areas after disabling the MMU.
On Monday, July 24, 2017 at 4:16:38 PM UTC-4, pat...@gmail.com wrote:For true baremetal stuff I guess a good starting point is to take a look at the Xilinx BSP source code:C:\Xilinx\SDK\2017.2\data\embeddedsw\lib\bsp\standalone_v6_3\src\arm\cortexa9\gccI don't remember the details regarding DDR but if I recall correctly, some of the initialization is done in ps7_init.c which is generated during export of the bitstream with Vivado. You probably also need to set the MMU properly in the PS
Bush,
I’m doing everything I can to do this outside of the SDK without linking to external libraries since it’s a learning project. Trying to go 0-to-kernel. As such I’m probably going to pore over ps7_init to find stuff, but I don’t want to actually use it in the project.
On Monday, July 24, 2017 at 4:47:05 PM UTC-4, Bush wrote:
> You should be able to use the generated DDR initialization in the ps7_init.c/h files directly in your bare-metal app. You will need to add the hardware configuration folder to your SDK project paths and add a linked file reference to the ps7_init.c file before you make calls to ps7_init() in your project.
>
> To add the hardware configuration to the project paths:
>
> 1. Right-click the project and select ‘Properties’
> 2. Select ‘C/C++ General >> Paths and Symbols’
> 3. In the ‘Includes’ tab select 'Add…"
> 4. Select ‘Workspace…’ and select the hardware configuration folder (probably ending in “_wrapper_hw_platform_0”) and select ‘OK’
>
> To add the ps7_init.c file to you’re project:
>
> 1. Right-click the ‘src’ folder for your project (or any other source folder in your project)
> 2. Select ‘New >> File’
> 3. Click ‘Advanced >>’ and select ‘Link to file in the file system’
> 4. Click ‘Browse…’ and select the ps7_init.c file from your hardware configuration folder and click ‘Open’
> 5. Click ‘Finish’
>
> Now you can add an #include “ps7_init.h” directive to your project and make a call to ps7_init(). If you created your project with a standalone project template, you should see this include and a call to ps7_init that has been commented out in your platform.c file:
>
> void
> init_platform()
> {
> /*
> * If you want to run this example outside of SDK,
> * uncomment one of the following two lines and also #include “ps7_init.h”
> * or #include “ps7_init.h” at the top, depending on the target.
> * Make sure that the ps7/psu_init.c and ps7/psu_init.h files are included
> * along with this example source files for compilation.
> /
> / ps7_init();/
> / psu_init();*/
> enable_caches();
> init_uart();
> }
>
> You can also have all of the initialization done by FSBL and then combine the two when generating your boot image. I’m not sure exactly what you’re trying to accomplish so let me know if this makes sense with the setup you have or if you have any questions about the process.
>
> On Monday, July 24, 2017 at 1:23:15 PM UTC-7, hedg...@gmail.com wrote:
> Yes and no, afaict. With MMU disabled and DDR controller enabled, I should be able to access the full 1 GB of DRAM without dabrt. I have mmu disabled but ddr is not enabled. Been snooping through the sources for dram code, still cant find anything though. Uboot wasn’t helpful, since uboot is a monster of a project with compat files for every board its compatible with. However, I’m going to keep on looking and see what I can find. ps7_init will definitely have dram init code as well, haven’t had a chance to look yet though. I can only find info on the mmu from disassembling a simple hello_world app built with the xsdk, though, and the dram initialization details should be in there. I’ll look at taking another look with raw gdb at a debug build of a hello_world app on the metal and see if I dabrt by writing directly to DRAM areas after disabling the MMU.
>
> On Monday, July 24, 2017 at 4:16:38 PM UTC-4, pat...@gmail.com wrote:
>
> For true baremetal stuff I guess a good starting point is to take a look at the Xilinx BSP source code:
>
>
> C:\Xilinx\SDK\2017.2\data\embeddedsw\lib\bsp\standalone_v6_3\src\arm\cortexa9\gcc
>
>
> I don’t remember the details regarding DDR but if I recall correctly, some of the initialization is done in ps7_init.c which is generated during export of the bitstream with Vivado. You probably also need to set the MMU properly in the PS
EMIT_MASKWRITE(<ADDRESS>, <MASK>, <VALUE>),
ex:
EMIT_MASKWRITE(0XF8006000, 0x0001FFFFU ,0x00000080U),
Unfortunately, there isn't a hardware-level driver that packages up these operations into meaningful functions driven by human-readable data structures.
On Monday, July 24, 2017 at 4:35:39 PM UTC-7, hedg...@gmail.com wrote:
Bush,
I'm doing everything I can to do this outside of the SDK without linking to external libraries since it's a learning project. Trying to go 0-to-kernel. As such I'm probably going to pore over ps7_init to find stuff, but I don't want to actually use it in the project.
On Monday, July 24, 2017 at 4:47:05 PM UTC-4, Bush wrote:
> You should be able to use the generated DDR initialization in the ps7_init.c/h files directly in your bare-metal app. You will need to add the hardware configuration folder to your SDK project paths and add a linked file reference to the ps7_init.c file before you make calls to ps7_init() in your project.
>
> To add the hardware configuration to the project paths:
>
> 1. Right-click the project and select 'Properties'
> 2. Select 'C/C++ General >> Paths and Symbols'
> 3. In the 'Includes' tab select 'Add..."
> 4. Select 'Workspace...' and select the hardware configuration folder (probably ending in "_wrapper_hw_platform_0") and select 'OK'
>
> To add the ps7_init.c file to you're project:
>
> 1. Right-click the 'src' folder for your project (or any other source folder in your project)
> 2. Select 'New >> File'
> 3. Click 'Advanced >>' and select 'Link to file in the file system'
> 4. Click 'Browse...' and select the ps7_init.c file from your hardware configuration folder and click 'Open'
> 5. Click 'Finish'
>
> Now you can add an #include "ps7_init.h" directive to your project and make a call to ps7_init(). If you created your project with a standalone project template, you should see this include and a call to ps7_init that has been commented out in your platform.c file:
>
> void
> init_platform()
> {
> /*
> * If you want to run this example outside of SDK,
> * uncomment one of the following two lines and also #include "ps7_init.h"
> * or #include "ps7_init.h" at the top, depending on the target.
> * Make sure that the ps7/psu_init.c and ps7/psu_init.h files are included
> * along with this example source files for compilation.
> */
> /* ps7_init();*/
> /* psu_init();*/
> enable_caches();
> init_uart();
> }
>
> You can also have all of the initialization done by FSBL and then combine the two when generating your boot image. I'm not sure exactly what you're trying to accomplish so let me know if this makes sense with the setup you have or if you have any questions about the process.
>
> On Monday, July 24, 2017 at 1:23:15 PM UTC-7, hedg...@gmail.com wrote:
> Yes and no, afaict. With MMU disabled and DDR controller enabled, I should be able to access the full 1 GB of DRAM without dabrt. I have mmu disabled but ddr is not enabled. Been snooping through the sources for dram code, still cant find anything though. Uboot wasn't helpful, since uboot is a monster of a project with compat files for every board its compatible with. However, I'm going to keep on looking and see what I can find. ps7_init will definitely have dram init code as well, haven't had a chance to look yet though. I can only find info on the mmu from disassembling a simple hello_world app built with the xsdk, though, and the dram initialization details should be in there. I'll look at taking another look with raw gdb at a debug build of a hello_world app on the metal and see if I dabrt by writing directly to DRAM areas after disabling the MMU.
>
> On Monday, July 24, 2017 at 4:16:38 PM UTC-4, pat...@gmail.com wrote:
>
> For true baremetal stuff I guess a good starting point is to take a look at the Xilinx BSP source code:
>
>
> C:\Xilinx\SDK\2017.2\data\embeddedsw\lib\bsp\standalone_v6_3\src\arm\cortexa9\gcc
>
>
> I don't remember the details regarding DDR but if I recall correctly, some of the initialization is done in ps7_init.c which is generated during export of the bitstream with Vivado. You probably also need to set the MMU properly in the PS