Using QGIS 3.2
Add a base map
Install the plugin QuickMapServices.
Plugins menu > manage and install plugins > find and install Quickmapservices
The QuickMapServices button is on the Manage Layers toolbar. Click this button, and add a base map. OSM Standard is a good option.
Import the trail GPX file
Drag the GPX file into the QGIS window. QGIS will ask which parts of the GPS you want to import. Import the route or track, whichever one has features. In my example, the trail is stored a route.
Now you have a line layer called "trailname_routes" (or "trailname_tracks").
Make sure that the trail shows up at the correct location relative to the basemap.
Re-project the trail layer into a projected coordinate reference system
Your GPX file is probably in the standard geographic coordinate system WGS84. This system uses latitute and longitude decimal degrees. In order to do a distance calculation in feet or meters, we need to project the layer into a coordinate reference system that uses those units. If your file is already in a projected coordinate reference system, skip this step.
Right click on the "trailname_routes" in the layer panel. Choose Export > Save features as...
Click the button next to CRS
Choose an appropriate projected CRS. I'm assuming your trail is in the US. In the Coordinate Reference Selector window, search for the name of US state that the trail is in. Choose the local CRS with the units you want to use for distance calculations. (If you want to do calculations in feet and miles, choose one that uses ftUS as its units. If you want to use meters, choose one that uses meters.)
Choose one with NAD83 or NAD_1983 in the name. Avoid any with "deprecated" in the name. Don't worry about the difference between "HARN" and "FIPS."
For example, for a trail in western Maine, and distance calculations in feet, I would choose this one:
Save the trail somewhere on your computer. This file is just for calculations, you won't need to upload it to your GPS.
Add points along the trail at fixed distance intervals
Decide how far apart you want these points, in the units of the CRS. For example, if you want a point every mile along the trail and your CRS uses feet, you would want them 5280 feet apart. Every half mile would be 2640 feet apart.
Open the Processing toolbox (Processing menu > toolbox). Search for "points along geometry". Double click to open this tool.
For input layer, choose the projected trail layer that you created in the last step. For distance, input the distance you calculated, eg 5280 feet. Run the tool.
Now you have a layer of points spaced 1 mile apart along the trail.
Preserve the distance value
The distance along the line is saved as an field called "distance". GPX format only allow specific fields. When exported to GPX format, the "distance" field will be deleted. So we have to copy the distance values into one of the fields that will be saved. The "name" field is usually the one displayed as a label on the GPS device, so we'll copy the distance value into the 'name' field.
Use the Field Calculator to update the "name" field with the expression
Or you might want to round the distance value if it has a lot of decimal places. In that case, use the expression
round("distance", n) where n is the number of decimal places you want.
If you want to convert from feet to miles, use the expression
Export the marker points layer in GPX format
Choose WGS84 as the CRS.
Unselect all fields below "link2_type". If you get an error message like the one below, go back and unselect the field that it mentioned :
Export to vector file failed.
Error: Creation of field number failed (OGR error: Field of name 'number' is not supported in GPX schema. Use GPX_USE_EXTENSIONS creation option to allow use of the element.)
Import the distance marker points into your GPS
Make sure the distance value is displayed as labels for these points. If not, you should be able change a setting in the GPS to make it use the "name" field as a label. Otherwise you'll need to figure out which field of the GPX is used for labels, and go back into QGIS and put the distance value in that field.